diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-04-20 17:53:24 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-20 17:27:30 +0200 |
commit | e578b7884ba755ff31555299ea1b14c1f28cc29c (patch) | |
tree | 032547660654c89a0198c303e9cd87e67a2ee804 /Libraries/LibLine/Editor.h | |
parent | 42f06fc305e093bd31915984b50b96242ca11157 (diff) | |
download | serenity-e578b7884ba755ff31555299ea1b14c1f28cc29c.zip |
LibLine: Properly handle ^C and do not return after being interrupted
this commit fixes a...surprisingly long-standing ^C bug, where it would
return the buffer instead of voiding it and starting over :^)
Diffstat (limited to 'Libraries/LibLine/Editor.h')
-rw-r--r-- | Libraries/LibLine/Editor.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Libraries/LibLine/Editor.h b/Libraries/LibLine/Editor.h index 4909ea458f..e7d6271625 100644 --- a/Libraries/LibLine/Editor.h +++ b/Libraries/LibLine/Editor.h @@ -167,10 +167,12 @@ private: m_refresh_needed = true; m_search_offset = 0; if (m_reset_buffer_on_search_end) { - m_buffer = m_pre_search_buffer; + m_buffer.clear(); + for (auto ch : m_pre_search_buffer) + m_buffer.append(ch); m_cursor = m_pre_search_cursor; } - m_reset_buffer_on_search_end = false; + m_reset_buffer_on_search_end = true; m_search_editor = nullptr; } |