Patch 8.2.0867
Problem:    Using \{xxx} for encoding a modifier is not nice.
Solution:   Use \<*xxx> instead, since it's the same as \<xxx> but producing a
            different code.
Files:      runtime/doc/eval.txt, src/typval.c, src/misc2.c, src/vim.h,
            src/testdir/test_backspace_opt.vim, src/testdir/test_mapping.vim,
            src/testdir/test_messages.vim


*** ../vim-8.2.0866/runtime/doc/eval.txt        2020-05-31 15:41:53.155138624 
+0200
--- runtime/doc/eval.txt        2020-05-31 21:36:42.705148553 +0200
***************
*** 1351,1358 ****
        To use the double quote character it must be escaped: "<M-\">".
        Don't use <Char-xxxx> to get a utf-8 character, use \uxxxx as
        mentioned above.
! \{xxx}        like \<xxx> but prepends a modifier instead of including it in 
the
!       character.  E.g. "\<C-w>" is one character 0x17 while "\{C-w}" is four
        bytes: 3 for the CTRL modifier and then character "W".
  
  Note that "\xff" is stored as the byte 255, which may be invalid in some
--- 1353,1360 ----
        To use the double quote character it must be escaped: "<M-\">".
        Don't use <Char-xxxx> to get a utf-8 character, use \uxxxx as
        mentioned above.
! \<*xxx>       Like \<xxx> but prepends a modifier instead of including it in 
the
!       character.  E.g. "\<C-w>" is one character 0x17 while "\<*C-w>" is four
        bytes: 3 for the CTRL modifier and then character "W".
  
  Note that "\xff" is stored as the byte 255, which may be invalid in some
*** ../vim-8.2.0866/src/typval.c        2020-05-30 21:52:49.238816739 +0200
--- src/typval.c        2020-05-31 21:47:33.818535941 +0200
***************
*** 1285,1300 ****
                          ++name;
                          break;
  
!                         // Special key, e.g.: "\<C-W>" or "\{C-W}"
                case '<':
-               case '{':
                          {
                              int flags = FSK_KEYCODE | FSK_IN_STRING;
  
!                             if (*p == '<')
                                  flags |= FSK_SIMPLIFY;
-                             else
-                                 flags |= FSK_CURLY;
                              extra = trans_special(&p, name, flags, NULL);
                              if (extra != 0)
                              {
--- 1285,1297 ----
                          ++name;
                          break;
  
!                         // Special key, e.g.: "\<C-W>"
                case '<':
                          {
                              int flags = FSK_KEYCODE | FSK_IN_STRING;
  
!                             if (p[1] != '*')
                                  flags |= FSK_SIMPLIFY;
                              extra = trans_special(&p, name, flags, NULL);
                              if (extra != 0)
                              {
*** ../vim-8.2.0866/src/misc2.c 2020-05-30 21:52:49.238816739 +0200
--- src/misc2.c 2020-05-31 21:43:22.051584894 +0200
***************
*** 2772,2784 ****
      int               modifiers;
      int               bit;
      int               key;
-     int               endchar = (flags & FSK_CURLY) ? '}' : '>';
      uvarnumber_T      n;
      int               l;
  
      src = *srcp;
!     if (src[0] != ((flags & FSK_CURLY) ? '{' : '<'))
        return 0;
  
      // Find end of modifier list
      last_dash = src;
--- 2772,2785 ----
      int               modifiers;
      int               bit;
      int               key;
      uvarnumber_T      n;
      int               l;
  
      src = *srcp;
!     if (src[0] != '<')
        return 0;
+     if (src[1] == '*')            // <*xxx>: do not simplify
+       ++src;
  
      // Find end of modifier list
      last_dash = src;
***************
*** 2796,2810 ****
                // Anything accepted, like <C-?>.
                // <C-"> or <M-"> are not special in strings as " is
                // the string delimiter. With a backslash it works: <M-\">
!               if (!(in_string && bp[1] == '"') && bp[l + 1] == endchar)
                    bp += l;
                else if (in_string && bp[1] == '\\' && bp[2] == '"'
!                                                          && bp[3] == endchar)
                    bp += 2;
            }
        }
        if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3])
!           bp += 3;    // skip t_xx, xx may be '-' or '>'/'}'
        else if (STRNICMP(bp, "char-", 5) == 0)
        {
            vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE);
--- 2797,2811 ----
                // Anything accepted, like <C-?>.
                // <C-"> or <M-"> are not special in strings as " is
                // the string delimiter. With a backslash it works: <M-\">
!               if (!(in_string && bp[1] == '"') && bp[l + 1] == '>')
                    bp += l;
                else if (in_string && bp[1] == '\\' && bp[2] == '"'
!                                                          && bp[3] == '>')
                    bp += 2;
            }
        }
        if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3])
!           bp += 3;    // skip t_xx, xx may be '-' or '>'
        else if (STRNICMP(bp, "char-", 5) == 0)
        {
            vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE);
***************
*** 2818,2824 ****
        }
      }
  
!     if (*bp == endchar)       // found matching '>' or '}'
      {
        end_of_name = bp + 1;
  
--- 2819,2825 ----
        }
      }
  
!     if (*bp == '>')   // found matching '>'
      {
        end_of_name = bp + 1;
  
***************
*** 2864,2870 ****
                    l = mb_ptr2len(last_dash + off);
                else
                    l = 1;
!               if (modifiers != 0 && last_dash[l + off] == endchar)
                    key = PTR2CHAR(last_dash + off);
                else
                {
--- 2865,2871 ----
                    l = mb_ptr2len(last_dash + off);
                else
                    l = 1;
!               if (modifiers != 0 && last_dash[l + off] == '>')
                    key = PTR2CHAR(last_dash + off);
                else
                {
*** ../vim-8.2.0866/src/vim.h   2020-05-30 21:52:49.238816739 +0200
--- src/vim.h   2020-05-31 21:47:41.930500507 +0200
***************
*** 2666,2671 ****
  #define FSK_KEEP_X_KEY        0x02    // don't translate xHome to Home key
  #define FSK_IN_STRING 0x04    // TRUE in string, double quote is escaped
  #define FSK_SIMPLIFY  0x08    // simplify <C-H> and <A-x>
- #define FSK_CURLY     0x10    // {C-x} instead of <C-x>
  
  #endif // VIM__H
--- 2666,2670 ----
*** ../vim-8.2.0866/src/testdir/test_backspace_opt.vim  2020-05-30 
21:52:49.242816719 +0200
--- src/testdir/test_backspace_opt.vim  2020-05-31 21:44:47.811249865 +0200
***************
*** 86,92 ****
  
    set cpo-=<
    inoremap <c-u> <left><c-u>
!   exe "normal Avim3\{C-U}\<Esc>\<CR>"
    iunmap <c-u>
    exe "normal Avim4\<C-U>\<C-U>\<Esc>\<CR>"
  
--- 86,92 ----
  
    set cpo-=<
    inoremap <c-u> <left><c-u>
!   exe "normal Avim3\<*C-U>\<Esc>\<CR>"
    iunmap <c-u>
    exe "normal Avim4\<C-U>\<C-U>\<Esc>\<CR>"
  
***************
*** 96,102 ****
    exe "normal A vim6\<Esc>Azwei\<C-G>u\<C-U>\<Esc>\<CR>"
  
    inoremap <c-u> <left><c-u>
!   exe "normal A vim7\{C-U}\{C-U}\<Esc>\<CR>"
  
    call assert_equal([
          \ "1 this shouldn't be deleted",
--- 96,102 ----
    exe "normal A vim6\<Esc>Azwei\<C-G>u\<C-U>\<Esc>\<CR>"
  
    inoremap <c-u> <left><c-u>
!   exe "normal A vim7\<*C-U>\<*C-U>\<Esc>\<CR>"
  
    call assert_equal([
          \ "1 this shouldn't be deleted",
*** ../vim-8.2.0866/src/testdir/test_mapping.vim        2020-05-30 
21:52:49.242816719 +0200
--- src/testdir/test_mapping.vim        2020-05-31 21:45:43.307024388 +0200
***************
*** 76,82 ****
    inoremap <c-c> <ctrl-c>
    cnoremap <c-c> dummy
    cunmap <c-c>
!   call feedkeys("GoTEST2: CTRL-C |\{C-C}A|\<Esc>", "xt")
    call assert_equal('TEST2: CTRL-C |<ctrl-c>A|', getline('$'))
    unmap! <c-c>
    set nomodified
--- 76,82 ----
    inoremap <c-c> <ctrl-c>
    cnoremap <c-c> dummy
    cunmap <c-c>
!   call feedkeys("GoTEST2: CTRL-C |\<*C-C>A|\<Esc>", "xt")
    call assert_equal('TEST2: CTRL-C |<ctrl-c>A|', getline('$'))
    unmap! <c-c>
    set nomodified
***************
*** 85,91 ****
  func Test_map_ctrl_c_visual()
    " mapping of ctrl-c in Visual mode
    vnoremap <c-c> :<C-u>$put ='vmap works'
!   call feedkeys("GV\{C-C}\<CR>", "xt")
    call assert_equal('vmap works', getline('$'))
    vunmap <c-c>
    set nomodified
--- 85,91 ----
  func Test_map_ctrl_c_visual()
    " mapping of ctrl-c in Visual mode
    vnoremap <c-c> :<C-u>$put ='vmap works'
!   call feedkeys("GV\<*C-C>\<CR>", "xt")
    call assert_equal('vmap works', getline('$'))
    vunmap <c-c>
    set nomodified
***************
*** 235,241 ****
  
  func Test_map_meta_quotes()
    imap <M-"> foo
!   call feedkeys("Go-\{M-\"}-\<Esc>", "xt")
    call assert_equal("-foo-", getline('$'))
    set nomodified
    iunmap <M-">
--- 235,241 ----
  
  func Test_map_meta_quotes()
    imap <M-"> foo
!   call feedkeys("Go-\<*M-\">-\<Esc>", "xt")
    call assert_equal("-foo-", getline('$'))
    set nomodified
    iunmap <M-">
*** ../vim-8.2.0866/src/testdir/test_messages.vim       2020-05-31 
21:27:58.331221914 +0200
--- src/testdir/test_messages.vim       2020-05-31 21:46:07.982914331 +0200
***************
*** 306,312 ****
  func Test_mapping_at_hit_return_prompt()
    nnoremap <C-B> :echo "hit ctrl-b"<CR>
    call feedkeys(":ls\<CR>", "xt")
!   call feedkeys("\{C-B}", "xt")
    call assert_match('hit ctrl-b', Screenline(&lines - 1))
    nunmap <C-B>
  endfunc
--- 306,312 ----
  func Test_mapping_at_hit_return_prompt()
    nnoremap <C-B> :echo "hit ctrl-b"<CR>
    call feedkeys(":ls\<CR>", "xt")
!   call feedkeys("\<*C-B>", "xt")
    call assert_match('hit ctrl-b', Screenline(&lines - 1))
    nunmap <C-B>
  endfunc
*** ../vim-8.2.0866/src/version.c       2020-05-31 21:27:58.335221898 +0200
--- src/version.c       2020-05-31 21:52:14.793334787 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     867,
  /**/

-- 
Google is kind of like Dr. Who's Tardis; it's weirder on the
inside than on the outside...

 /// 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/202005312007.04VK7Uc4734885%40masaka.moolenaar.net.

Raspunde prin e-mail lui