patch 9.0.0748: Kitty may send key without modifiers with CSI u code
Problem: Kitty may send key without modifiers with CSI u code.
Solution: Handle CSI u code without modifiers. (Trygve Aaberge,
closes #11364)
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 12c5737..8bf2fe3 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -1992,6 +1992,11 @@
return "\<Esc>[" .. key .. ';' .. mod .. 'u'
endfunc
+func GetEscCodeCSIuWithoutModifier(key)
+ let key = printf("%d", char2nr(a:key))
+ return "\<Esc>[" .. key .. 'u'
+endfunc
+
" This checks the CSI sequences when in modifyOtherKeys mode.
" The mode doesn't need to be enabled, the codes are always detected.
func RunTest_modifyOtherKeys(func)
@@ -2080,6 +2085,19 @@
set timeoutlen&
endfunc
+func Test_CSIu_keys_without_modifiers()
+ " Escape sent as `CSI 27 u` should act as normal escape and not undo
+ call setline(1, 'a')
+ call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\e"), 'Lx!')
+ call assert_equal('n', mode())
+ call assert_equal('a', getline(1))
+
+ " Tab sent as `CSI 9 u` should work
+ call setline(1, '')
+ call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\t") .. "\<Esc>", 'Lx!')
+ call assert_equal("\t", getline(1))
+endfunc
+
" Check that when DEC mouse codes are recognized a special key is handled.
func Test_ignore_dec_mouse()
silent !infocmp gnome >/dev/null 2>&1