Patch 8.2.2728
Problem:    Special key names don't work if 'isident' is cleared.
Solution:   Add vim_isNormalIDc() and use it for special key names.
            (closes #2389)
Files:      src/charset.c, src/proto/charset.pro, src/misc2.c,
            src/testdir/test_mapping.vim


*** ../vim-8.2.2727/src/charset.c       2021-03-29 20:49:01.486055361 +0200
--- src/charset.c       2021-04-06 19:43:52.180216749 +0200
***************
*** 835,840 ****
--- 835,850 ----
  }
  
  /*
+  * Like vim_isIDc() but not using the 'isident' option: letters, numbers and
+  * underscore.
+  */
+     int
+ vim_isNormalIDc(int c)
+ {
+     return ASCII_ISALNUM(c) || c == '_';
+ }
+ 
+ /*
   * return TRUE if 'c' is a keyword character: Letters and characters from
   * 'iskeyword' option for the current buffer.
   * For multi-byte characters mb_get_class() is used (builtin rules).
*** ../vim-8.2.2727/src/proto/charset.pro       2020-06-10 14:16:30.098988403 
+0200
--- src/proto/charset.pro       2021-04-06 19:43:54.268211265 +0200
***************
*** 19,24 ****
--- 19,25 ----
  int linetabsize_col(int startcol, char_u *s);
  int win_linetabsize(win_T *wp, char_u *line, colnr_T len);
  int vim_isIDc(int c);
+ int vim_isNormalIDc(int c);
  int vim_iswordc(int c);
  int vim_iswordc_buf(int c, buf_T *buf);
  int vim_iswordp(char_u *p);
*** ../vim-8.2.2727/src/misc2.c 2021-03-21 20:53:24.930400991 +0100
--- src/misc2.c 2021-04-06 19:46:43.843767359 +0200
***************
*** 2826,2832 ****
  
      // Find end of modifier list
      last_dash = src;
!     for (bp = src + 1; *bp == '-' || vim_isIDc(*bp); bp++)
      {
        if (*bp == '-')
        {
--- 2826,2832 ----
  
      // Find end of modifier list
      last_dash = src;
!     for (bp = src + 1; *bp == '-' || vim_isNormalIDc(*bp); bp++)
      {
        if (*bp == '-')
        {
***************
*** 3121,3130 ****
        for (i = 0; key_names_table[i].name != NULL; i++)
        {
            table_name = key_names_table[i].name;
!           for (j = 0; vim_isIDc(name[j]) && table_name[j] != NUL; j++)
                if (TOLOWER_ASC(table_name[j]) != TOLOWER_ASC(name[j]))
                    break;
!           if (!vim_isIDc(name[j]) && table_name[j] == NUL)
                return key_names_table[i].key;
        }
      return 0;
--- 3121,3130 ----
        for (i = 0; key_names_table[i].name != NULL; i++)
        {
            table_name = key_names_table[i].name;
!           for (j = 0; vim_isNormalIDc(name[j]) && table_name[j] != NUL; j++)
                if (TOLOWER_ASC(table_name[j]) != TOLOWER_ASC(name[j]))
                    break;
!           if (!vim_isNormalIDc(name[j]) && table_name[j] == NUL)
                return key_names_table[i].key;
        }
      return 0;
*** ../vim-8.2.2727/src/testdir/test_mapping.vim        2021-03-22 
19:37:02.545019774 +0100
--- src/testdir/test_mapping.vim        2021-04-06 19:46:05.515867484 +0200
***************
*** 445,453 ****
    " Remove default mappings
    imapclear
  
!   inoremap <C-M> CtrlM
    inoremap <A-S> AltS
    inoremap <S-/> ShiftSlash
    call assert_equal([
        \ 'i  <S-/>       * ShiftSlash',
        \ 'i  <M-S>       * AltS',
--- 445,456 ----
    " Remove default mappings
    imapclear
  
!   " reset 'isident' to check it isn't used
!   set isident=
!   inoremap <C-m> CtrlM
    inoremap <A-S> AltS
    inoremap <S-/> ShiftSlash
+   set isident&
    call assert_equal([
        \ 'i  <S-/>       * ShiftSlash',
        \ 'i  <M-S>       * AltS',
*** ../vim-8.2.2727/src/version.c       2021-04-06 20:18:23.331648347 +0200
--- src/version.c       2021-04-06 20:20:11.379393914 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2728,
  /**/

-- 
Q: How many legs does a giraffe have?
A: Eight: two in front, two behind, two on the left and two on the right

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/202104061822.136IMUWs3405823%40masaka.moolenaar.net.

Raspunde prin e-mail lui