Do not record keys that were not user generated
This commit is contained in:
parent
e8c8833211
commit
f56b6ed75b
|
@ -1090,6 +1090,8 @@ void InputHandler::handle_key(Key key)
|
||||||
if (is_valid(key))
|
if (is_valid(key))
|
||||||
{
|
{
|
||||||
const bool was_recording = is_recording();
|
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();
|
auto keymap_mode = m_mode->keymap_mode();
|
||||||
KeymapManager& keymaps = m_context.keymaps();
|
KeymapManager& keymaps = m_context.keymaps();
|
||||||
|
@ -1102,8 +1104,9 @@ void InputHandler::handle_key(Key key)
|
||||||
else
|
else
|
||||||
m_mode->on_key(key);
|
m_mode->on_key(key);
|
||||||
|
|
||||||
// do not record the key that made us enter or leave recording mode.
|
// do not record the key that made us enter or leave recording mode,
|
||||||
if (was_recording and is_recording())
|
// 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);
|
m_recorded_keys += key_to_str(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,8 @@ private:
|
||||||
|
|
||||||
char m_recording_reg = 0;
|
char m_recording_reg = 0;
|
||||||
String m_recorded_keys;
|
String m_recorded_keys;
|
||||||
|
|
||||||
|
int m_handle_key_level = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user