summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-11-21 19:00:34 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-11-21 19:00:34 +0000
commitf56b6ed75b2eeec6d069388ae13904ed72b403e1 (patch)
tree5846fc7e9b900ded85e4de532ca59893a1ac9277 /src/input_handler.cc
parente8c88332110ef0e2ddb35b7a2621fa0902dac0fe (diff)
Do not record keys that were not user generated
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 16f482d6..b543a268 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1090,6 +1090,8 @@ void InputHandler::handle_key(Key key)
if (is_valid(key))
{
const bool was_recording = is_recording();
+ ++m_handle_key_level;
+ auto dec = on_scope_end([&]{ --m_handle_key_level; });
auto keymap_mode = m_mode->keymap_mode();
KeymapManager& keymaps = m_context.keymaps();
@@ -1102,8 +1104,9 @@ void InputHandler::handle_key(Key key)
else
m_mode->on_key(key);
- // do not record the key that made us enter or leave recording mode.
- if (was_recording and is_recording())
+ // do not record the key that made us enter or leave recording mode,
+ // and the ones that are triggered recursively by previous keys.
+ if (was_recording and is_recording() and m_handle_key_level == 1)
m_recorded_keys += key_to_str(key);
}
}