LibLine: Actually cancel the search editor on Ctl-C
When the search editor calls on really_quit_event_loop to cancel the search, the command loaded in m_buffer would actually execute because really_quit_event_loop sends a new line character and then afterwards clears the buffer. By using end_search prior to exiting the event loop, this patch will appropriately clear the buffer, not execute any commands, and preserve the original loaded buffer after returning from a canceled search.
This commit is contained in:
parent
1748591570
commit
7843287d89
Notes:
sideshowbarker
2024-07-18 16:56:24 +09:00
Author: https://github.com/brapru Commit: https://github.com/SerenityOS/serenity/commit/7843287d899 Pull-request: https://github.com/SerenityOS/serenity/pull/7760
1 changed files with 1 additions and 0 deletions
|
@ -264,6 +264,7 @@ void Editor::enter_search()
|
|||
m_search_editor->register_key_input_callback(ctrl('C'), [this](Editor& search_editor) {
|
||||
search_editor.finish();
|
||||
m_reset_buffer_on_search_end = true;
|
||||
search_editor.end_search();
|
||||
search_editor.deferred_invoke([&search_editor](auto&) { search_editor.really_quit_event_loop(); });
|
||||
return false;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue