diff options
author | brapru <brapru@pm.me> | 2021-06-03 22:50:42 -0400 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-04 11:00:24 +0430 |
commit | 7843287d8992989e0235175cd1b4fbdb2bc5d15e (patch) | |
tree | ed40f11a69b70608229b78559eab38e891357783 /Userland/Libraries | |
parent | 1748591570172d9ff9c5843bdc5ea94d49106c7f (diff) | |
download | serenity-7843287d8992989e0235175cd1b4fbdb2bc5d15e.zip |
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibLine/InternalFunctions.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp index b94f8d4067..834335d46c 100644 --- a/Userland/Libraries/LibLine/InternalFunctions.cpp +++ b/Userland/Libraries/LibLine/InternalFunctions.cpp @@ -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; }); |