LibLine: Make sure suggestions have their *_views set correctly

This commit is contained in:
Ali Mohammad Pur 2022-03-06 17:59:12 +03:30 committed by Andreas Kling
parent a76730823a
commit 941550e601
Notes: sideshowbarker 2024-07-17 17:52:44 +09:00

View file

@ -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) {