summaryrefslogtreecommitdiff
path: root/Libraries/LibLine/Editor.h
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-04-29 00:31:22 +0430
committerAndreas Kling <kling@serenityos.org>2020-04-28 23:29:07 +0200
commit7ecf29f206eb8e471a9efc77b3356f4881fd635c (patch)
tree332326e29feac28c58443c558fb7c6782021608a /Libraries/LibLine/Editor.h
parent8b195d1211cc8a4b154ab82ead21d35d738f5a24 (diff)
downloadserenity-7ecf29f206eb8e471a9efc77b3356f4881fd635c.zip
LibLine: Ignore interrupts unless actively editing
It does not make much sense to receive an interrupt and process it *much later*. Also patches Userland/js to only create exceptions while some code is actually running.
Diffstat (limited to 'Libraries/LibLine/Editor.h')
-rw-r--r--Libraries/LibLine/Editor.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Libraries/LibLine/Editor.h b/Libraries/LibLine/Editor.h
index e7d6271625..4569e95c79 100644
--- a/Libraries/LibLine/Editor.h
+++ b/Libraries/LibLine/Editor.h
@@ -107,7 +107,11 @@ public:
// FIXME: we will have to kindly ask our instantiators to set our signal handlers
// since we can not do this cleanly ourselves (signal() limitation: cannot give member functions)
- void interrupted() { m_was_interrupted = true; }
+ void interrupted()
+ {
+ if (m_is_editing)
+ m_was_interrupted = true;
+ }
void resized() { m_was_resized = true; }
size_t cursor() const { return m_cursor; }
@@ -148,6 +152,8 @@ public:
m_finish = true;
}
+ bool is_editing() const { return m_is_editing; }
+
private:
void vt_save_cursor();
void vt_restore_cursor();
@@ -291,6 +297,8 @@ private:
bool m_initialized { false };
bool m_refresh_needed { false };
+
+ bool m_is_editing { false };
};
}