]> granicus.if.org Git - vim/commitdiff
patch 8.2.2938: after using motion force from feedkeys() it sticks v8.2.2938
authorBram Moolenaar <Bram@vim.org>
Fri, 4 Jun 2021 19:57:57 +0000 (21:57 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Jun 2021 19:57:57 +0000 (21:57 +0200)
Problem:    After using motion force from feedkeys() it may not be reset.
Solution:   Clear motion_force in clearop(). (closes #8323)

src/normal.c
src/testdir/test_visual.vim
src/version.c

index c4c167935ed64cf615df74402dfaffabc613dac1..fe47e2b74d857f698c0437709606e586b2e98485 100644 (file)
@@ -1750,6 +1750,7 @@ clearop(oparg_T *oap)
     oap->regname = 0;
     oap->motion_force = NUL;
     oap->use_reg_one = FALSE;
+    motion_force = NUL;
 }
 
     void
index 1b3661c228996a830fa14014eddc53a529d67a5e..b368c32b1f936b6f846f4846cc4333bd055ddfb5 100644 (file)
@@ -913,6 +913,15 @@ func Test_visual_block_mode()
   set tabstop& shiftwidth&
 endfunc
 
+func Test_visual_force_motion_feedkeys()
+    onoremap <expr> i- execute('let g:mode = mode(1)')->slice(0, 0)
+    call feedkeys('dvi-', 'x')
+    call assert_equal('nov', g:mode)
+    call feedkeys('di-', 'x')
+    call assert_equal('no', g:mode)
+    ounmap i-
+endfunc
+
 " Test block-insert using cursor keys for movement
 func Test_visual_block_insert_cursor_keys()
   new
index d59df5c3c7e936efb0651b626497643017b98bb1..3ac26ab405dd0a181f842ba142ee6f1e515a3369 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2938,
 /**/
     2937,
 /**/