Skip to content

Commit

Permalink
LibLine: Make sure suggestions have their *_views set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpfard authored and awesomekling committed Mar 6, 2022
1 parent a767308 commit 941550e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Userland/Libraries/LibLine/SuggestionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 941550e

Please sign in to comment.