summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine/Editor.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-02-07 03:12:17 +0330
committerAndreas Kling <kling@serenityos.org>2021-02-07 13:12:56 +0100
commit3a231c00aa80fe1e2ff38771874cb6b680558308 (patch)
tree666aaaff12ea157f2059d71ef78b26715f5f039b /Userland/Libraries/LibLine/Editor.cpp
parent5204c9062c5e2fd6448ce7da7ed6a223cfe77b23 (diff)
downloadserenity-3a231c00aa80fe1e2ff38771874cb6b680558308.zip
LibLine: Close the search editor when it's interrupted
Fixes #5233.
Diffstat (limited to 'Userland/Libraries/LibLine/Editor.cpp')
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 2bba9c740f..326b5d079b 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -539,7 +539,7 @@ void Editor::interrupted()
m_was_interrupted = true;
handle_interrupt_event();
- if (!m_finish)
+ if (!m_finish || !m_previous_interrupt_was_handled_as_interrupt)
return;
m_finish = false;
@@ -681,11 +681,14 @@ void Editor::try_update_once()
void Editor::handle_interrupt_event()
{
m_was_interrupted = false;
+ m_previous_interrupt_was_handled_as_interrupt = false;
m_callback_machine.interrupted(*this);
if (!m_callback_machine.should_process_last_pressed_key())
return;
+ m_previous_interrupt_was_handled_as_interrupt = true;
+
fprintf(stderr, "^C");
fflush(stderr);