summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-11-14 13:59:33 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-11-14 19:39:35 +0000
commitb3ba769220aad0a3ac2a969d43c58396b3753aa7 (patch)
treefb01b5f5e8cd5260ea23aff309bcdcf9ba017f94 /src/input_handler.cc
parentcb074793a0af099754a7fba9c2a5755bd2130d31 (diff)
Propagate the hooks disabled state through prompt, menu, and command execution
Maintain it as well during buffer creation even if the hooks are not executed in client context. Fixes #818
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 231d97f0..7a4ecabd 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -528,6 +528,10 @@ public:
if (context().has_client())
context().client().menu_hide();
context().print_status(DisplayLine{});
+
+ // Maintain hooks disabled in callback if they were before pop_mode
+ ScopedSetBool disable_hooks(context().hooks_disabled(),
+ context().hooks_disabled());
pop_mode();
int selected = m_selected - m_choices.begin();
m_callback(selected, MenuEvent::Validate, context());
@@ -546,6 +550,10 @@ public:
{
if (context().has_client())
context().client().menu_hide();
+
+ // Maintain hooks disabled in callback if they were before pop_mode
+ ScopedSetBool disable_hooks(context().hooks_disabled(),
+ context().hooks_disabled());
pop_mode();
int selected = m_selected - m_choices.begin();
m_callback(selected, MenuEvent::Abort, context());
@@ -680,6 +688,10 @@ public:
context().print_status(DisplayLine{});
if (context().has_client())
context().client().menu_hide();
+
+ // Maintain hooks disabled in callback if they were before pop_mode
+ ScopedSetBool disable_hooks(context().hooks_disabled(),
+ context().hooks_disabled());
pop_mode();
// call callback after pop_mode so that callback
// may change the mode
@@ -693,6 +705,10 @@ public:
context().print_status(DisplayLine{});
if (context().has_client())
context().client().menu_hide();
+
+ // Maintain hooks disabled in callback if they were before pop_mode
+ ScopedSetBool disable_hooks(context().hooks_disabled(),
+ context().hooks_disabled());
pop_mode();
m_callback(line, PromptEvent::Abort, context());
return;
@@ -935,6 +951,9 @@ public:
void on_key(Key key) override
{
+ // maintain hooks disabled in the callback if they were before pop_mode
+ ScopedSetBool disable_hooks(context().hooks_disabled(),
+ context().hooks_disabled());
pop_mode();
m_callback(key, context());
}