summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-07-08 13:52:41 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-07-08 13:53:19 +0100
commit883a14e8531162c51c6b64b1405efccb6fc1fa8e (patch)
treeeb9ef5c6ae6aed5fe97be8023dea3d9b735e037d /src/input_handler.cc
parent123541822b079dd49229f10d8b37c6babcd71dc6 (diff)
Do not allow exiting insert mode while running InsertEnd hook.
Fixes #311
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 30c14110..4e74f3b9 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -956,7 +956,11 @@ public:
bool moved = false;
if (key == Key::Escape or key == ctrl('c'))
{
+ if (m_in_end)
+ throw runtime_error("Asked to exit insert mode while running InsertEnd hook");
+ m_in_end = true;
context().hooks().run_hook("InsertEnd", "", context());
+
m_completer.reset();
pop_mode(keep_alive);
}
@@ -1175,6 +1179,7 @@ private:
bool m_autoshowcompl;
Timer m_idle_timer;
bool m_disable_hooks;
+ bool m_in_end = false;
};
}