summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-07 17:29:48 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-07 17:29:48 +0200
commit9a033d7b18651acbb7eda4b7f39a27c01748fb70 (patch)
tree996ceabce395813ba39a08c4930e672f9e465839 /src
parentd7e5e9430ae192c76f1f03c3ac53fae823d94c33 (diff)
patch 8.2.1811: mapping Ctrl-key does not work for '{', '}' and '|'v8.2.1811
Problem: Mapping Ctrl-key does not work for '{', '}' and '|'. Solution: Remove the shift modifier. (closes #6457)
Diffstat (limited to 'src')
-rw-r--r--src/misc2.c8
-rw-r--r--src/testdir/test_termcodes.vim18
-rw-r--r--src/version.c2
3 files changed, 27 insertions, 1 deletions
diff --git a/src/misc2.c b/src/misc2.c
index b69714a8da..6316b53df4 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2974,7 +2974,8 @@ may_adjust_key_for_ctrl(int modifiers, int key)
/*
* Some keys already have Shift included, pass them as normal keys.
- * Not when Ctrl is also used, because <C-H> and <C-S-H> are different.
+ * When Ctrl is also used <C-H> and <C-S-H> are different, but <C-S-{> should
+ * be <C-{>. Same for <C-S-}> and <C-S-|>.
* Also for <A-S-a> and <M-S-a>.
* This includes all printable ASCII characters except numbers and a-z.
*/
@@ -2989,6 +2990,11 @@ may_remove_shift_modifier(int modifiers, int key)
|| (key >= '[' && key <= '`')
|| (key >= '{' && key <= '~')))
return modifiers & ~MOD_MASK_SHIFT;
+
+ if (modifiers == (MOD_MASK_SHIFT | MOD_MASK_CTRL)
+ && (key == '{' || key == '}' || key == '|'))
+ return modifiers & ~MOD_MASK_SHIFT;
+
return modifiers;
}
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 7d7e2f0987..424e285ef1 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -2126,6 +2126,24 @@ endfunc
func Test_mapping_works_with_shift_ctrl()
call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-S', 6)
call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-S', 6)
+
+ new
+ set timeoutlen=10
+
+ " Ctrl-Shift-[ actually produces CTRL-Shift-{ which is mapped as <C-{>
+ call RunTest_mapping_mods('<C-{>', '{', function('GetEscCodeCSI27'), 6)
+ call RunTest_mapping_mods('<C-{>', '{', function('GetEscCodeCSIu'), 6)
+
+ " Ctrl-Shift-] actually produces CTRL-Shift-} which is mapped as <C-}>
+ call RunTest_mapping_mods('<C-{>', '{', function('GetEscCodeCSI27'), 6)
+ call RunTest_mapping_mods('<C-{>', '{', function('GetEscCodeCSIu'), 6)
+
+ " Ctrl-Shift-\ actually produces CTRL-Shift-| which is mapped as <C-|>
+ call RunTest_mapping_mods('<C-\|>', '|', function('GetEscCodeCSI27'), 6)
+ call RunTest_mapping_mods('<C-\|>', '|', function('GetEscCodeCSIu'), 6)
+
+ bwipe!
+ set timeoutlen&
endfunc
" Below we also test the "u" code with Alt, This works, but libvterm would not
diff --git a/src/version.c b/src/version.c
index 140b3c8e20..a2929bc3f7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1811,
+/**/
1810,
/**/
1809,