0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 9.0.0939: still using simplified mappings when using kitty protocol

Problem:    Still using simplified mappings when using the kitty keyboard
            protocol.
Solution:   Use the kitty_protocol_state value to decide whether to use
            simplified mappings.  Improve how seenModifyOtherKeys is set and
            reset.
This commit is contained in:
Bram Moolenaar
2022-11-24 13:27:36 +00:00
parent 0b228cddc7
commit 47f1fdc28c
5 changed files with 60 additions and 6 deletions

View File

@@ -2455,6 +2455,17 @@ check_simplify_modifier(int max_offset)
return 0;
}
/*
* Return TRUE if the terminal sends modifiers with various keys. This is when
* modifyOtherKeys level 2 is enabled or the kitty keyboard protocol is
* enabled.
*/
static int
key_protocol_enabled(void)
{
return seenModifyOtherKeys || kitty_protocol_state == KKPS_ENABLED;
}
/*
* Handle mappings in the typeahead buffer.
* - When something was mapped, return map_result_retry for recursive mappings.
@@ -2564,7 +2575,7 @@ handle_mapping(
// Skip ":lmap" mappings if keys were mapped.
if (mp->m_keys[0] == tb_c1
&& (mp->m_mode & local_State)
&& !(mp->m_simplified && seenModifyOtherKeys
&& !(mp->m_simplified && key_protocol_enabled()
&& typebuf.tb_maplen == 0)
&& ((mp->m_mode & MODE_LANGMAP) == 0
|| typebuf.tb_maplen == 0))