summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-12 15:36:11 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-12 15:36:11 +0200
commit18a79a68413365cd7672728d54615ca708764e23 (patch)
tree4cf04c08309e056c790b903ed9a7cce16ff01dd9
parent4cdbed33e467bdfed9aa90dc0f96642c91db32bb (diff)
patch 8.1.2139: the modifyOtherKeys codes are not testedv8.1.2139
Problem: The modifyOtherKeys codes are not tested. Solution: Add a test case.
-rw-r--r--src/testdir/test_termcodes.vim64
-rw-r--r--src/version.c2
2 files changed, 66 insertions, 0 deletions
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 22e7a04de1..0d157aeb42 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -845,3 +845,67 @@ func Test_get_termcode()
set ttybuiltin
endfunc
+
+func GetEscCodeCSI27(key, modifier)
+ let key = printf("%d", char2nr(a:key))
+ let mod = printf("%d", a:modifier)
+ return "\<Esc>[27;" .. mod .. ';' .. key .. '~'
+endfunc
+
+func GetEscCodeCSIu(key, modifier)
+ let key = printf("%d", char2nr(a:key))
+ let mod = printf("%d", a:modifier)
+ return "\<Esc>[" .. key .. ';' .. mod .. '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)
+ new
+ set timeoutlen=20
+
+ " Shift-X is send as 'X' with the shift modifier
+ call feedkeys('a' .. a:func('X', 2) .. "\<Esc>", 'Lx!')
+ call assert_equal('X', getline(1))
+
+ " Ctrl-i is Tab
+ call setline(1, '')
+ call feedkeys('a' .. a:func('i', 5) .. "\<Esc>", 'Lx!')
+ call assert_equal("\t", getline(1))
+
+ " Ctrl-I is also Tab
+ call setline(1, '')
+ call feedkeys('a' .. a:func('I', 5) .. "\<Esc>", 'Lx!')
+ call assert_equal("\t", getline(1))
+
+ " Alt-x is ø
+ call setline(1, '')
+ call feedkeys('a' .. a:func('x', 3) .. "\<Esc>", 'Lx!')
+ call assert_equal("ø", getline(1))
+
+ " Meta-x is also ø
+ call setline(1, '')
+ call feedkeys('a' .. a:func('x', 9) .. "\<Esc>", 'Lx!')
+ call assert_equal("ø", getline(1))
+
+ " Alt-X is Ø
+ call setline(1, '')
+ call feedkeys('a' .. a:func('X', 3) .. "\<Esc>", 'Lx!')
+ call assert_equal("Ø", getline(1))
+
+ " Meta-X is ø
+ call setline(1, '')
+ call feedkeys('a' .. a:func('X', 9) .. "\<Esc>", 'Lx!')
+ call assert_equal("Ø", getline(1))
+
+ bwipe!
+ set timeoutlen&
+endfunc
+
+func Test_modifyOtherKeys_CSI27()
+ call RunTest_modifyOtherKeys(function('GetEscCodeCSI27'))
+endfunc
+
+func Test_modifyOtherKeys_CSIu()
+ call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
+endfunc
diff --git a/src/version.c b/src/version.c
index 9cb3a01568..87b3a33996 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2139,
+/**/
2138,
/**/
2137,