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
This commit is contained in:
hanaa12G 2023-12-02 20:06:45 +07:00 committed by Ali Mohammad Pur
commit e6cde722c9
Notes: sideshowbarker 2024-07-17 06:33:00 +09:00

View file

@ -620,8 +620,10 @@ ErrorOr<void> 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();