Patch 8.1.2142
Problem: Some key mappings do not work with modifyOtherKeys.
Solution: Remove the Shift modifier if it is already included in the key.
Files: src/term.c, src/testdir/test_termcodes.vim
*** ../vim-8.1.2141/src/term.c 2019-10-10 21:13:59.958360367 +0200
--- src/term.c 2019-10-12 18:15:55.839388142 +0200
***************
*** 4847,4854 ****
else
key = arg[2];
- // insert modifiers with KS_MODIFIER
modifiers = decode_modifiers(arg[1]);
new_slen = modifiers2keycode(modifiers, &key, string);
slen = csi_len;
--- 4847,4863 ----
else
key = arg[2];
modifiers = decode_modifiers(arg[1]);
+
+ // Some keys already have Shift included, pass them as
+ // normal keys.
+ if (modifiers == MOD_MASK_SHIFT
+ && ((key >= '@' && key <= 'Z')
+ || key == '^' || key == '_'
+ || (key >= '{' && key <= '~')))
+ modifiers = 0;
+
+ // insert modifiers with KS_MODIFIER
new_slen = modifiers2keycode(modifiers, &key, string);
slen = csi_len;
*** ../vim-8.1.2141/src/testdir/test_termcodes.vim 2019-10-12
15:36:06.236897202 +0200
--- src/testdir/test_termcodes.vim 2019-10-12 18:21:27.117861048 +0200
***************
*** 909,911 ****
--- 909,950 ----
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
*** ../vim-8.1.2141/src/version.c 2019-10-12 17:06:48.798440368 +0200
--- src/version.c 2019-10-12 18:16:44.667153449 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 2142,
/**/
--
The Law, in its majestic equality, forbids the rich, as well as the
poor, to sleep under the bridges, to beg in the streets, and to steal
bread. -- Anatole France
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201910121624.x9CGO7rF020288%40masaka.moolenaar.net.