mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 17:57:35 +00:00
LibLine: Handle ^L while in search mode
This commit fixes the following misbehaviour: ``` > <- search prompt moves here > > ^R^L <- actual prompt stays here ```
This commit is contained in:
parent
905de7df58
commit
7f1d3f6d62
1 changed files with 22 additions and 0 deletions
|
@ -690,6 +690,28 @@ String Editor::get_line(const String& prompt)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ^L - This is a source of issues, as the search editor refreshes first,
|
||||||
|
// and we end up with the wrong order of prompts, so we will first refresh
|
||||||
|
// ourselves, then refresh the search editor, and then tell him not to process
|
||||||
|
// this event
|
||||||
|
m_search_editor->register_character_input_callback(0x0c, [this](auto& search_editor) {
|
||||||
|
printf("\033[3J\033[H\033[2J"); // Clear screen.
|
||||||
|
|
||||||
|
// refresh our own prompt
|
||||||
|
m_origin_x = 1;
|
||||||
|
m_origin_y = 1;
|
||||||
|
m_refresh_needed = true;
|
||||||
|
refresh_display();
|
||||||
|
|
||||||
|
// move the search prompt below ours
|
||||||
|
// and tell it to redraw itself
|
||||||
|
search_editor.m_origin_x = 2;
|
||||||
|
search_editor.m_origin_y = 1;
|
||||||
|
search_editor.m_refresh_needed = true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
// quit without clearing the current buffer
|
// quit without clearing the current buffer
|
||||||
m_search_editor->register_character_input_callback('\t', [this](Editor& search_editor) {
|
m_search_editor->register_character_input_callback('\t', [this](Editor& search_editor) {
|
||||||
search_editor.finish();
|
search_editor.finish();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue