summaryrefslogtreecommitdiff
path: root/Libraries/LibLine/Editor.h
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-04-20 17:53:24 +0430
committerAndreas Kling <kling@serenityos.org>2020-04-20 17:27:30 +0200
commite578b7884ba755ff31555299ea1b14c1f28cc29c (patch)
tree032547660654c89a0198c303e9cd87e67a2ee804 /Libraries/LibLine/Editor.h
parent42f06fc305e093bd31915984b50b96242ca11157 (diff)
downloadserenity-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.h6
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;
}