summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine/Editor.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/Editor.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/Editor.cpp')
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 8d3bf9a331..61a3e10b7e 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -1121,17 +1121,15 @@ void Editor::handle_read_event()
break;
}
- if (m_times_tab_pressed > 1) {
- if (m_suggestion_manager.count() > 0) {
- if (m_suggestion_display->cleanup())
- reposition_cursor(stderr_stream);
+ if (m_times_tab_pressed > 1 && m_suggestion_manager.count() > 0) {
+ if (m_suggestion_display->cleanup())
+ reposition_cursor(stderr_stream);
- m_suggestion_display->set_initial_prompt_lines(m_prompt_lines_at_suggestion_initiation);
+ m_suggestion_display->set_initial_prompt_lines(m_prompt_lines_at_suggestion_initiation);
- m_suggestion_display->display(m_suggestion_manager);
+ m_suggestion_display->display(m_suggestion_manager);
- m_origin_row = m_suggestion_display->origin_row();
- }
+ m_origin_row = m_suggestion_display->origin_row();
}
if (m_times_tab_pressed > 2) {