From 941550e601b2976dcaddb837520d43e28b7895be Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 6 Mar 2022 17:59:12 +0330 Subject: [PATCH] LibLine: Make sure suggestions have their *_views set correctly --- Userland/Libraries/LibLine/SuggestionManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp index 80cf37b4577..d569de39a5a 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.cpp +++ b/Userland/Libraries/LibLine/SuggestionManager.cpp @@ -31,9 +31,12 @@ void SuggestionManager::set_suggestions(Vector&& suggestio { m_suggestions = move(suggestions); - // make sure we were not given invalid suggestions - for (auto& suggestion : m_suggestions) + // Set the views and make sure we were not given invalid suggestions + for (auto& suggestion : m_suggestions) { VERIFY(suggestion.is_valid); + suggestion.text_view = { suggestion.text.data(), suggestion.text.size() }; + suggestion.trivia_view = { suggestion.trailing_trivia.data(), suggestion.trailing_trivia.size() }; + } size_t common_suggestion_prefix { 0 }; if (m_suggestions.size() == 1) {