From 6f0bde11ccd82d257fcda25ecad26227eba3335e Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 15 Jan 2025 11:07:51 -0600 Subject: 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. --- test/functional/terminal/buffer_spec.lua | 8 ++++++++ test/unit/vterm_spec.lua | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'test') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 66b75a4ea2..a524e49ef4 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -629,6 +629,14 @@ describe('terminal input', function() -- TODO(bfredl): getcharstr() erases the distinction between and . -- If it was enhanced or replaced this could get folded into the test above. it('can send TAB/C-I and ESC/C-[ separately', function() + if + skip( + is_os('win'), + "The escape sequence to enable kitty keyboard mode doesn't work on Windows" + ) + then + return + end clear() local screen = tt.setup_child_nvim({ '-u', diff --git a/test/unit/vterm_spec.lua b/test/unit/vterm_spec.lua index 6ff3c18d2a..9f70187fad 100644 --- a/test/unit/vterm_spec.lua +++ b/test/unit/vterm_spec.lua @@ -2324,6 +2324,9 @@ putglyph 1f3f4,200d,2620,fe0f 2 0,4]]) local vt = init() local state = wantstate(vt) + -- Disambiguate escape codes + push('\x1b[>1u', vt) + -- Unmodified ASCII inchar(41, vt) expect('output 29') @@ -2478,6 +2481,8 @@ putglyph 1f3f4,200d,2620,fe0f 2 0,4]]) expect_output('\x1b[I') vterm.vterm_state_focus_out(state) expect_output('\x1b[O') + + push('\x1b[