From e6cde722c98395c2e741830c0b26aed04957c064 Mon Sep 17 00:00:00 2001 From: hanaa12G Date: Sat, 2 Dec 2023 20:06:45 +0700 Subject: [PATCH] LibLine: Reset `m_times_tab_pressed` in interrupt handling code We forgot to reset all the variables that keep track of suggestion state, resulting in an underflow value when calculating the lines to display completion suggestions later. Setting `m_times_tab_pressed` to 0 apparently forces it to recalculate the those variables and seems to fix the problem. Fixes #22128 --- Userland/Libraries/LibLine/Editor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index ca15aeb78e..99cd037272 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -620,8 +620,10 @@ ErrorOr Editor::interrupted() { auto stderr_stream = TRY(Core::File::standard_error()); TRY(reposition_cursor(*stderr_stream, true)); - if (TRY(m_suggestion_display->cleanup())) + if (TRY(m_suggestion_display->cleanup())) { + m_times_tab_pressed = 0; TRY(reposition_cursor(*stderr_stream, true)); + } TRY(stderr_stream->write_until_depleted("\r"sv.bytes())); } m_buffer.clear();