Patch 8.2.1811
Problem:    Mapping Ctrl-key does not work for '{', '}' and '|'.
Solution:   Remove the shift modifier. (closes #6457)
Files:      runtime/doc/map.txt, src/misc2.c, src/testdir/test_termcodes.vim


*** ../vim-8.2.1810/runtime/doc/map.txt 2020-08-01 20:45:06.924096157 +0200
--- runtime/doc/map.txt 2020-10-07 17:25:35.313913734 +0200
***************
*** 840,852 ****
  
  When modifyOtherKeys is enabled you can map <C-[> and <C-S-{>: >
        imap <C-[> [[[
!       imap <C-S-{> {{{
! Without modifyOtherKeys <C-[> and <C-S-{> are indistinguishable from Esc.
! 
! A known side effect effect is that in Insert mode the raw escape sequence is
! inserted after the CTRL-V key.  This can be used to check whether
! modifyOtherKeys is enabled: In Insert mode type CTRL-V CTRL-V, if you get
! one byte then modifyOtherKeys is off, if you get <1b>27;5;118~ then it is on.
  
  When the 'esckeys' option is off, then modifyOtherKeys will be disabled in
  Insert mode to avoid every key with a modifier causing Insert mode to end.
--- 850,869 ----
  
  When modifyOtherKeys is enabled you can map <C-[> and <C-S-{>: >
        imap <C-[> [[[
!       imap <C-{> {{{
! Without modifyOtherKeys <C-[> and <C-{> are indistinguishable from Esc.
! Note that <C-{> is used and not <C-S-[> or <C-S-{>.  This works on most
! keyboards.  Similarly, <C-}> is used instead of <C-S-]> or <C-S-}> and
! <C-|> instead of <C-S-\> or <C-S-|>.  Note that '|' has a special meaning in a
! mapping, see |map-bar|.
! 
! WARNING: if you map <C-[> you may very well break any key codes that start
! with Esc.  Make sure it comes AFTER other mappings.
! 
! A known side effect is that in Insert mode the raw escape sequence is inserted
! after the CTRL-V key.  This can be used to check whether modifyOtherKeys is
! enabled: In Insert mode type CTRL-SHIFT-V CTRL-V, if you get one byte then
! modifyOtherKeys is off, if you get <1b>27;5;118~ then it is on.
  
  When the 'esckeys' option is off, then modifyOtherKeys will be disabled in
  Insert mode to avoid every key with a modifier causing Insert mode to end.
*** ../vim-8.2.1810/src/misc2.c 2020-10-07 16:12:33.905930345 +0200
--- src/misc2.c 2020-10-07 17:22:13.930487925 +0200
***************
*** 2974,2980 ****
  
  /*
   * 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.
   * Also for <A-S-a> and <M-S-a>.
   * This includes all printable ASCII characters except numbers and a-z.
   */
--- 2974,2981 ----
  
  /*
   * Some keys already have Shift included, pass them as normal keys.
!  * 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,2994 ****
--- 2990,3000 ----
                || (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;
  }
  
*** ../vim-8.2.1810/src/testdir/test_termcodes.vim      2020-10-07 
16:12:33.909930340 +0200
--- src/testdir/test_termcodes.vim      2020-10-07 17:23:23.698288353 +0200
***************
*** 2126,2131 ****
--- 2126,2149 ----
  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
*** ../vim-8.2.1810/src/version.c       2020-10-07 16:54:48.523247873 +0200
--- src/version.c       2020-10-07 17:19:01.291043780 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1811,
  /**/

-- 
The future isn't what it used to be.

 /// 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/202010071530.097FUFvJ2972486%40masaka.moolenaar.net.

Raspunde prin e-mail lui