diff options
| author | Tobias Pisani <topisani@hamsterpoison.com> | 2024-02-23 16:53:30 +0100 |
|---|---|---|
| committer | Tobias Pisani <topisani@hamsterpoison.com> | 2024-02-24 05:18:56 +0100 |
| commit | dbe8528231f61717210f796c93c85b852b760b33 (patch) | |
| tree | a89cf707517da5c1b57710927d5acc889f2dcab8 /src/input_handler.cc | |
| parent | 2d9c84e363d499eb699540c53d9f912f446a4d30 (diff) | |
Make insert repeat (.) more consistent
Insert repeat will now only record non-synthesized keys, and when played back
execute mappings as well. Constructing some tests, and with the specific goal
of fixing https://github.com/alexherbo2/auto-pairs.kak/issues/38, this appeared to
be the best approach. Other options could be evaluating the maps only when recording,
but this gave other issues (see tests/normal/repeat-insert/repeat-insert-mapped)
At this point, repeat-insert may be essentially just a hardcoded macro, at least I
haven't identified the difference. If this really is the case, it may make sense to
give it a dedicated register, and implement it as a macro.
Fixes #3600
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 17e72874..9d81f711 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1582,7 +1582,7 @@ void InputHandler::repeat_last_insert() // refill last_insert, this is very inefficient, but necessary at the moment // to properly handle insert completion m_last_insert.keys.push_back(key); - current_mode().handle_key(key, true); + handle_key(key); } kak_assert(dynamic_cast<InputModes::Normal*>(¤t_mode()) != nullptr); } @@ -1655,11 +1655,12 @@ void InputHandler::handle_key(Key key) auto dec = on_scope_end([this]{ --m_handle_key_level;} ); auto process_key = [&](Key key, bool synthesized) { - if (m_last_insert.recording) - m_last_insert.keys.push_back(key); current_mode().handle_key(key, synthesized); }; + if (m_last_insert.recording and m_handle_key_level <= 1) + m_last_insert.keys.push_back(key); + 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()) |
