diff src/testdir/test_termcodes.vim @ 18295:43e9523f6d84 v8.1.2142

patch 8.1.2142: some key mappings do not work with modifyOtherKeys Commit: https://github.com/vim/vim/commit/d1e2f3984ae0b4e22ba6977eedcf05285819eea9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 12 18:22:50 2019 +0200 patch 8.1.2142: some key mappings do not work with modifyOtherKeys Problem: Some key mappings do not work with modifyOtherKeys. Solution: Remove the Shift modifier if it is already included in the key.
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Oct 2019 18:30:04 +0200
parents 16dd8ebc2339
children 506bf60a30a0
line wrap: on
line diff
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -909,3 +909,42 @@ endfunc
 func Test_modifyOtherKeys_CSIu()
   call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
 endfunc
+
+func RunTest_mapping_shift(key, func)
+  call setline(1, '')
+  if a:key == '|'
+    exe 'inoremap \| xyz'
+  else
+    exe 'inoremap ' .. a:key .. ' xyz'
+  endif
+  call feedkeys('a' .. a:func(a:key, 2) .. "\<Esc>", 'Lx!')
+  call assert_equal("xyz", getline(1))
+  if a:key == '|'
+    exe 'iunmap \|'
+  else
+    exe 'iunmap ' .. a:key
+  endif
+endfunc
+
+func RunTest_mapping_works_with_shift(func)
+  new
+  set timeoutlen=20
+
+  call RunTest_mapping_shift('@', a:func)
+  call RunTest_mapping_shift('A', a:func)
+  call RunTest_mapping_shift('Z', a:func)
+  call RunTest_mapping_shift('^', a:func)
+  call RunTest_mapping_shift('_', a:func)
+  call RunTest_mapping_shift('{', a:func)
+  call RunTest_mapping_shift('|', a:func)
+  call RunTest_mapping_shift('}', a:func)
+  call RunTest_mapping_shift('~', a:func)
+
+  bwipe!
+  set timeoutlen&
+endfunc
+
+func Test_mapping_works_with_shift()
+  call RunTest_mapping_works_with_shift(function('GetEscCodeCSI27'))
+  call RunTest_mapping_works_with_shift(function('GetEscCodeCSIu'))
+endfunc