mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibLine: Make sure suggestions have their *_views set correctly
This commit is contained in:
parent
a76730823a
commit
941550e601
Notes:
sideshowbarker
2024-07-17 17:52:44 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/941550e601 Pull-request: https://github.com/SerenityOS/serenity/pull/12908
1 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue