summaryrefslogtreecommitdiff
path: root/Libraries/LibLine/Editor.h
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-06-01 16:26:31 +0430
committerAndreas Kling <kling@serenityos.org>2020-06-01 19:52:20 +0200
commit889a8e7d0fb5bc6556daa6fffdc55aed74f0e60a (patch)
tree1f3c89ffa668e01758d56577196702cbee75b94b /Libraries/LibLine/Editor.h
parent29029568ee5d52f67a639d93ed71bdc56033342b (diff)
downloadserenity-889a8e7d0fb5bc6556daa6fffdc55aed74f0e60a.zip
LibLine: Handle interrupts again
This commit makes LibLine handle interrupts (as reported via interrupted() and resized()) again. There is a little catch with the shell: ``` $ ls | pipe> <C-c> (prompt stays here until a key is pressed) ```
Diffstat (limited to 'Libraries/LibLine/Editor.h')
-rw-r--r--Libraries/LibLine/Editor.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/Libraries/LibLine/Editor.h b/Libraries/LibLine/Editor.h
index c3f8db1cb7..3ebb9e1d52 100644
--- a/Libraries/LibLine/Editor.h
+++ b/Libraries/LibLine/Editor.h
@@ -114,10 +114,16 @@ public:
// since we can not do this cleanly ourselves. (signal() limitation: cannot give member functions)
void interrupted()
{
- if (m_is_editing)
+ if (m_is_editing) {
m_was_interrupted = true;
+ handle_interrupt_event();
+ }
+ }
+ void resized()
+ {
+ m_was_resized = true;
+ refresh_display();
}
- void resized() { m_was_resized = true; }
size_t cursor() const { return m_cursor; }
const Vector<u32, 1024>& buffer() const { return m_buffer; }
@@ -176,6 +182,7 @@ private:
Function<bool(Editor&)> callback;
};
+ void handle_interrupt_event();
void handle_read_event();
Vector<size_t, 2> vt_dsr();