To: vim_dev@googlegroups.com Subject: Patch 8.1.2139 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2139 Problem: The modifyOtherKeys codes are not tested. Solution: Add a test case. Files: src/testdir/test_termcodes.vim *** ../vim-8.1.2138/src/testdir/test_termcodes.vim 2019-10-12 13:25:41.136648017 +0200 --- src/testdir/test_termcodes.vim 2019-10-12 15:27:00.263072489 +0200 *************** *** 845,847 **** --- 845,911 ---- set ttybuiltin endfunc + + func GetEscCodeCSI27(key, modifier) + let key = printf("%d", char2nr(a:key)) + let mod = printf("%d", a:modifier) + return "\[27;" .. mod .. ';' .. key .. '~' + endfunc + + func GetEscCodeCSIu(key, modifier) + let key = printf("%d", char2nr(a:key)) + let mod = printf("%d", a:modifier) + return "\[" .. 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) .. "\", 'Lx!') + call assert_equal('X', getline(1)) + + " Ctrl-i is Tab + call setline(1, '') + call feedkeys('a' .. a:func('i', 5) .. "\", 'Lx!') + call assert_equal("\t", getline(1)) + + " Ctrl-I is also Tab + call setline(1, '') + call feedkeys('a' .. a:func('I', 5) .. "\", 'Lx!') + call assert_equal("\t", getline(1)) + + " Alt-x is ø + call setline(1, '') + call feedkeys('a' .. a:func('x', 3) .. "\", 'Lx!') + call assert_equal("ø", getline(1)) + + " Meta-x is also ø + call setline(1, '') + call feedkeys('a' .. a:func('x', 9) .. "\", 'Lx!') + call assert_equal("ø", getline(1)) + + " Alt-X is Ø + call setline(1, '') + call feedkeys('a' .. a:func('X', 3) .. "\", 'Lx!') + call assert_equal("Ø", getline(1)) + + " Meta-X is ø + call setline(1, '') + call feedkeys('a' .. a:func('X', 9) .. "\", '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 *** ../vim-8.1.2138/src/version.c 2019-10-12 15:02:43.748980293 +0200 --- src/version.c 2019-10-12 15:35:52.532951044 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 2139, /**/ -- It is illegal for anyone to try and stop a child from playfully jumping over puddles of water. [real standing law in California, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///