1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibLine: Move the cursor to the beginning of the final line after ^C

We previously left it at the end of the final line, which caused the
next prompt to start offset to the right:
    |$ foo^C
    |  $
This commit makes LibLine move to the beginning of that line,
making it so the next prompt shows up at the beginning of the line:
    |$ foo^C
    |$
This commit is contained in:
Ali Mohammad Pur 2023-12-01 20:16:28 +03:30
parent fde174645a
commit 24a7df9b09

View file

@ -622,6 +622,7 @@ ErrorOr<void> Editor::interrupted()
TRY(reposition_cursor(*stderr_stream, true));
if (TRY(m_suggestion_display->cleanup()))
TRY(reposition_cursor(*stderr_stream, true));
TRY(stderr_stream->write_until_depleted("\r"sv.bytes()));
}
m_buffer.clear();
m_chars_touched_in_the_middle = buffer().size();
@ -816,7 +817,7 @@ void Editor::handle_interrupt_event()
m_previous_interrupt_was_handled_as_interrupt = true;
fprintf(stderr, "^C\r\n");
fprintf(stderr, "^C\n");
fflush(stderr);
if (on_interrupt_handled)