aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao <65860997+xiaopeng-ye@users.noreply.github.com>2021-08-29 23:08:39 +0200
committerGitHub <noreply@github.com>2021-08-29 17:08:39 -0400
commitb35de6c525e7c8ad9d64d42f57f348dff608b9e5 (patch)
tree040f2bd4f421c11e50f9925adac598e1714eb45c
parent4e66e74fd7c6afb1813c40dd59f17091e546789d (diff)
downloadrneovim-b35de6c525e7c8ad9d64d42f57f348dff608b9e5.tar.gz
rneovim-b35de6c525e7c8ad9d64d42f57f348dff608b9e5.tar.bz2
rneovim-b35de6c525e7c8ad9d64d42f57f348dff608b9e5.zip
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
-rw-r--r--src/nvim/normal.c1
-rw-r--r--src/nvim/testdir/test_visual.vim9
2 files changed, 10 insertions, 0 deletions
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 <expr> 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