diff --git a/src/edit.c b/src/edit.c index e1f30c7c2e..f4c5edfc43 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1625,7 +1625,8 @@ decodeModifyOtherKeys(int c) if (typebuf.tb_len >= 4 && (c == CSI || (c == ESC && *p == '['))) { idx = (*p == '['); - if (p[idx] == '2' && p[idx + 1] == '7' && p[idx + 2] == ';') + if (p[idx] == '2' && p[idx + 1] == '7' && p[idx + 2] == ';' && + kitty_protocol_state != KKPS_ENABLED) { form = 1; idx += 3; @@ -1640,9 +1641,10 @@ decodeModifyOtherKeys(int c) break; ++idx; } + int kitty_no_mods = argidx == 0 && kitty_protocol_state == KKPS_ENABLED; if (idx < typebuf.tb_len && p[idx] == (form == 1 ? '~' : 'u') - && argidx == 1) + && (argidx == 1 || kitty_no_mods)) { // Match, consume the code. typebuf.tb_off += idx + 1; @@ -1652,7 +1654,7 @@ decodeModifyOtherKeys(int c) typebuf_was_filled = FALSE; #endif - mod_mask = decode_modifiers(arg[!form]); + mod_mask = kitty_no_mods ? 0 : decode_modifiers(arg[!form]); c = merge_modifyOtherKeys(arg[form], &mod_mask); } } diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim index 507753c21a..2b44b15535 100644 --- a/src/testdir/test_termcodes.vim +++ b/src/testdir/test_termcodes.vim @@ -2001,6 +2001,12 @@ func Test_xx08_kitty_response() \ kitty: 'y', \ }, terminalprops()) + call feedkeys("\[?1u") " simulate the kitty keyboard protocol is enabled + call feedkeys(':' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIuWithoutModifier("\") .. "\\"\", 'Lx!') + call assert_equal("\"\", @:) + call feedkeys(':' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu("\", '129') .. "\\"\", 'Lx!') + call assert_equal("\"\", @:) + set t_RV= call test_override('term_props', 0) endfunc diff --git a/src/version.c b/src/version.c index b8852e39b4..b3cc9ce55b 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 788, /**/ 787, /**/