Patch 8.2.4203
Problem:    Entering a character with CTRL-V may include modifiers.
Solution:   Reset "mod_mask" when entering a character with digits after
            CTRL-V. (closes #9610)
Files:      src/edit.c, src/testdir/test_edit.vim


*** ../vim-8.2.4202/src/edit.c  2022-01-15 18:25:04.661419379 +0000
--- src/edit.c  2022-01-24 15:26:39.136344400 +0000
***************
*** 1909,1914 ****
--- 1909,1919 ----
        if ((nc == ESC || nc == CSI) && !noReduceKeys)
            nc = decodeModifyOtherKeys(nc);
  
+       if ((mod_mask & ~MOD_MASK_SHIFT) != 0)
+           // A character with non-Shift modifiers should not be a valid
+           // character for i_CTRL-V_digit.
+           break;
+ 
  #ifdef FEAT_CMDL_INFO
        if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1)
            add_to_showcmd(nc);
***************
*** 1986,1992 ****
--- 1991,2001 ----
        --allow_keys;
  #endif
      if (nc)
+     {
        vungetc(nc);
+       // A character typed with i_CTRL-V_digit cannot have modifiers.
+       mod_mask = 0;
+     }
      got_int = FALSE;      // CTRL-C typed after CTRL-V is not an interrupt
      return cc;
  }
*** ../vim-8.2.4202/src/testdir/test_edit.vim   2022-01-13 13:08:10.503904435 
+0000
--- src/testdir/test_edit.vim   2022-01-24 15:24:57.262264566 +0000
***************
*** 1073,1086 ****
  endfunc
  
  func Test_edit_CTRL_V()
!   CheckFeature ebcdic
    new
    call setline(1, ['abc'])
    call cursor(2, 1)
    " force some redraws
    set showmode showcmd
!   "call test_override_char_avail(1)
!   call test_override('ALL', 1)
    call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
    call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
  
--- 1073,1088 ----
  endfunc
  
  func Test_edit_CTRL_V()
!   CheckNotFeature ebcdic
! 
    new
    call setline(1, ['abc'])
    call cursor(2, 1)
+ 
    " force some redraws
    set showmode showcmd
!   call test_override('char_avail', 1)
! 
    call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
    call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
  
***************
*** 1093,1100 ****
      set norl
    endif
  
-   call test_override('ALL', 0)
    set noshowmode showcmd
    bw!
  endfunc
  
--- 1095,1113 ----
      set norl
    endif
  
    set noshowmode showcmd
+   call test_override('char_avail', 0)
+ 
+   " No modifiers should be applied to the char typed using i_CTRL-V_digit.
+   call 
feedkeys(":append\<CR>\<C-V>76c\<C-V>76\<C-F2>\<C-V>u3c0j\<C-V>u3c0\<M-F3>\<CR>.\<CR>",
 'tnix')
+   call assert_equal('LcL<C-F2>πjπ<M-F3>', getline(2))
+ 
+   if has('osx')
+     " A char with a modifier should not be a valid char for i_CTRL-V_digit.
+     call 
feedkeys("o\<C-V>\<D-j>\<C-V>\<D-1>\<C-V>\<D-o>\<C-V>\<D-x>\<C-V>\<D-u>", 
'tnix')
+     call assert_equal('<D-j><D-1><D-o><D-x><D-u>', getline(3))
+   endif
+ 
    bw!
  endfunc
  
*** ../vim-8.2.4202/src/version.c       2022-01-24 13:54:42.298380706 +0000
--- src/version.c       2022-01-24 15:15:26.716987187 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4203,
  /**/

-- 
Men may not be seen publicly in any kind of strapless gown.
                [real standing law in Florida, United States of America]

 /// 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/20220124152817.3D46B1C1AA3%40moolenaar.net.

Raspunde prin e-mail lui