summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-03-06 17:59:12 +0330
committerAndreas Kling <kling@serenityos.org>2022-03-06 15:34:27 +0100
commit941550e601b2976dcaddb837520d43e28b7895be (patch)
tree86381f1f6c76be716d4b2ee36b9f1efbca211b0d /Userland/Libraries/LibLine
parenta76730823ab3b7e125ea501e095a3ffd25a7dd18 (diff)
downloadserenity-941550e601b2976dcaddb837520d43e28b7895be.zip
LibLine: Make sure suggestions have their *_views set correctly
Diffstat (limited to 'Userland/Libraries/LibLine')
-rw-r--r--Userland/Libraries/LibLine/SuggestionManager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp
index 80cf37b457..d569de39a5 100644
--- a/Userland/Libraries/LibLine/SuggestionManager.cpp
+++ b/Userland/Libraries/LibLine/SuggestionManager.cpp
@@ -31,9 +31,12 @@ void SuggestionManager::set_suggestions(Vector<CompletionSuggestion>&& 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) {