aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2025-01-15 11:07:51 -0600
committerGregory Anders <greg@gpanders.com>2025-01-16 16:41:08 -0600
commit6f0bde11ccd82d257fcda25ecad26227eba3335e (patch)
tree846d1ac87aa3ef423f441414934a9a4ba50f45f8 /src/nvim/getchar.c
parentbbf36ef8ef86534e317e4e0153730a40ae4c936e (diff)
downloadrneovim-6f0bde11ccd82d257fcda25ecad26227eba3335e.tar.gz
rneovim-6f0bde11ccd82d257fcda25ecad26227eba3335e.tar.bz2
rneovim-6f0bde11ccd82d257fcda25ecad26227eba3335e.zip
feat(terminal): add support for kitty keyboard protocol
This commit adds basic support for the kitty keyboard protocol to Neovim's builtin terminal. For now only the first mode ("Disambiguate escape codes") is supported.
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 6cf4556a9f..6ec84ff543 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1517,12 +1517,10 @@ int merge_modifiers(int c_arg, int *modifiers)
int c = c_arg;
if (*modifiers & MOD_MASK_CTRL) {
- if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) {
- if (!(State & MODE_TERMINAL) || !(c == 'I' || c == 'J' || c == 'M' || c == '[')) {
- c &= 0x1f;
- if (c == NUL) {
- c = K_ZERO;
- }
+ if (c >= '@' && c <= 0x7f) {
+ c &= 0x1f;
+ if (c == NUL) {
+ c = K_ZERO;
}
} else if (c == '6') {
// CTRL-6 is equivalent to CTRL-^
@@ -2058,6 +2056,12 @@ static bool at_ins_compl_key(void)
/// @return the length of the replaced bytes, 0 if nothing changed, -1 for error.
static int check_simplify_modifier(int max_offset)
{
+ // We want full modifiers in Terminal mode so that the key can be correctly
+ // encoded
+ if (State & MODE_TERMINAL) {
+ return 0;
+ }
+
for (int offset = 0; offset < max_offset; offset++) {
if (offset + 3 >= typebuf.tb_len) {
break;