mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 03:46:31 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user