summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-24 13:27:36 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-24 13:27:36 +0000
commit47f1fdc28c6839ec8f5aede631d3a870624767b6 (patch)
tree1dd79cb5559e0218262250e0b0fd36f99f945854 /src/getchar.c
parent0b228cddc723af0c7ceb1cd73685b0b742f16713 (diff)
patch 9.0.0939: still using simplified mappings when using kitty protocolv9.0.0939
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.
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/getchar.c b/src/getchar.c
index e2474be0b1..fab721b6da 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2456,6 +2456,17 @@ check_simplify_modifier(int max_offset)
}
/*
+ * 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.
* - When nothing mapped and typeahead has a character: return map_result_get.
@@ -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))