1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

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
parent f976ec005c
commit e6cde722c9

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();