Slight code refactor in InputHandler::handle_key

This commit is contained in:
Maxime Coste 2018-01-15 10:25:58 +11:00
parent e74b581b0a
commit b4f8497f8d

View File

@ -1543,8 +1543,9 @@ static bool is_valid(Key key)
void InputHandler::handle_key(Key key)
{
if (is_valid(key))
{
if (not is_valid(key))
return;
const bool was_recording = is_recording();
++m_handle_key_level;
auto dec = on_scope_end([this]{ --m_handle_key_level; });
@ -1555,10 +1556,9 @@ void InputHandler::handle_key(Key key)
current_mode().handle_key(key);
};
auto keymap_mode = current_mode().keymap_mode();
const auto keymap_mode = current_mode().keymap_mode();
KeymapManager& keymaps = m_context.keymaps();
if (keymaps.is_mapped(key, keymap_mode) and
not m_context.keymaps_disabled())
if (keymaps.is_mapped(key, keymap_mode) and not m_context.keymaps_disabled())
{
ScopedSetBool disable_history{context().history_disabled()};
for (auto& k : keymaps.get_mapping(key, keymap_mode).keys)
@ -1579,7 +1579,6 @@ void InputHandler::handle_key(Key key)
m_recording_level = -1;
}
}
}
void InputHandler::start_recording(char reg)
{