From b3ba769220aad0a3ac2a969d43c58396b3753aa7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 14 Nov 2016 13:59:33 +0000 Subject: 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 --- src/input_handler.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/input_handler.cc') 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()); } -- cgit v1.2.3