diff options
| author | Gregory Anders <greg@gpanders.com> | 2025-01-16 18:33:22 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-16 18:33:22 -0600 |
| commit | bf098c12e3078df49fd7dee5ba7c2100a211d4c8 (patch) | |
| tree | 2a56e786310ebf7d5752c7b8dbc978eff7186b61 /src/nvim/terminal.c | |
| parent | fb564ddff0b4ec9dad5afa7548777af1c3044273 (diff) | |
| parent | 819337a13f73bb9dcd82fd51f81f062bd69ab6db (diff) | |
| download | rneovim-bf098c12e3078df49fd7dee5ba7c2100a211d4c8.tar.gz rneovim-bf098c12e3078df49fd7dee5ba7c2100a211d4c8.tar.bz2 rneovim-bf098c12e3078df49fd7dee5ba7c2100a211d4c8.zip | |
Merge pull request #32038 from gpanders/push-nsrttwwnsqvm
feat(terminal): add support for kitty keyboard protocol
Diffstat (limited to 'src/nvim/terminal.c')
| -rw-r--r-- | src/nvim/terminal.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 2ad5ac49ca..197a225209 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -783,7 +783,12 @@ static int terminal_execute(VimState *state, int key) { TerminalState *s = (TerminalState *)state; - switch (key) { + // Check for certain control keys like Ctrl-C and Ctrl-\. We still send the + // unmerged key and modifiers to the terminal. + int tmp_mod_mask = mod_mask; + int mod_key = merge_modifiers(key, &tmp_mod_mask); + + switch (mod_key) { case K_LEFTMOUSE: case K_LEFTDRAG: case K_LEFTRELEASE: @@ -841,13 +846,13 @@ static int terminal_execute(VimState *state, int key) FALLTHROUGH; default: - if (key == Ctrl_C) { + if (mod_key == Ctrl_C) { // terminal_enter() always sets `mapped_ctrl_c` to avoid `got_int`. 8eeda7169aa4 // But `got_int` may be set elsewhere, e.g. by interrupt() or an autocommand, // so ensure that it is cleared. got_int = false; } - if (key == Ctrl_BSL && !s->got_bsl) { + if (mod_key == Ctrl_BSL && !s->got_bsl) { s->got_bsl = true; break; } @@ -1016,7 +1021,7 @@ static void terminal_send_key(Terminal *term, int c) VTermKey key = convert_key(&c, &mod); - if (key) { + if (key != VTERM_KEY_NONE) { vterm_keyboard_key(term->vt, key, mod); } else if (!IS_SPECIAL(c)) { vterm_keyboard_unichar(term->vt, (uint32_t)c, mod); |