summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-12-14 14:03:57 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-12-16 03:26:59 +0330
commit86e1d1e73d632d50c2f89d0f6ac2e2e5cda94187 (patch)
tree5e97b6a23dcd78c353c4fb30befd491588a82225 /Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp
parentfa991255712c5252e16aee20321646ea32acd5f4 (diff)
downloadserenity-86e1d1e73d632d50c2f89d0f6ac2e2e5cda94187.zip
LibLine: Take the prompt into account when adjusting for a scrolled view
Otherwise we'd end up putting the prompt *after* the previous prompt instead of *over* it when showing suggestions that span more lines than are available without scrolling.
Diffstat (limited to 'Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp')
-rw-r--r--Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp
index 6e5a39bde0..d44f0d9de9 100644
--- a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp
+++ b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp
@@ -126,6 +126,9 @@ void XtermSuggestionDisplay::display(const SuggestionManager& manager)
m_lines_used_for_last_suggestions = lines_used;
+ // The last line of the prompt is the same line as the first line of the buffer, so we need to subtract one here.
+ lines_used += m_prompt_lines_at_suggestion_initiation - 1;
+
// If we filled the screen, move back the origin.
if (m_origin_row + lines_used >= m_num_lines) {
m_origin_row = m_num_lines - lines_used;