From 0f6654fef289421bafaacbae1aa5c04bf8292bd8 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Mon, 19 Jul 2021 23:10:18 +0430 Subject: [PATCH] LibLine: Reset the suggestion page offset when finding the max length Otherwise, something like shift+tab->tab->tab will mess up the page contents (assuming that the max lengths in the pages are different). --- Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp index 882b63f9ba..a691bba5df 100644 --- a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp +++ b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp @@ -20,6 +20,7 @@ void XtermSuggestionDisplay::display(const SuggestionManager& manager) size_t longest_suggestion_length = 0; size_t longest_suggestion_byte_length = 0; + manager.set_start_index(0); manager.for_each_suggestion([&](auto& suggestion, auto) { longest_suggestion_length = max(longest_suggestion_length, suggestion.text_view.length()); longest_suggestion_byte_length = max(longest_suggestion_byte_length, suggestion.text_string.length());