From b35de6c525e7c8ad9d64d42f57f348dff608b9e5 Mon Sep 17 00:00:00 2001 From: Xiao <65860997+xiaopeng-ye@users.noreply.github.com> Date: Sun, 29 Aug 2021 23:08:39 +0200 Subject: [PATCH] vim-patch:8.2.2938: after using motion force from feedkeys() it sticks (#15240) Problem: After using motion force from feedkeys() it may not be reset. Solution: Clear motion_force in clearop(). (closes vim/vim#8323) https://github.com/vim/vim/commit/21492743e80c6740bac65a91311c28bede8ef2f8 --- src/nvim/normal.c | 1 + src/nvim/testdir/test_visual.vim | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index ffcf659d28..4c3d7d58de 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3277,6 +3277,7 @@ static void clearop(oparg_T *oap) oap->regname = 0; oap->motion_force = NUL; oap->use_reg_one = false; + motion_force = NUL; } static void clearopbeep(oparg_T *oap) diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 9c62bdb16e..dbabdcf427 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -861,6 +861,15 @@ func Test_visual_block_mode() set tabstop& shiftwidth& endfunc +func Test_visual_force_motion_feedkeys() + onoremap i- execute('let g:mode = mode(1)') + 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