From 308fd88d0d48a21460cdc61966b7f249f3d26981 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 19 Oct 2021 22:39:25 +0800 Subject: vim-patch:8.2.3537: wrong mode() during 'operatorfunc' #16087 Problem: mode() does not return the right value in 'operatorfunc'. Solution: Reset finish_op while calling 'operatorfunc'. https://github.com/vim/vim/commit/75c30e96cf280a8cc01ac01c41a9252db3e503cc --- src/nvim/testdir/test_functions.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index a0e9f780c6..d10fad690c 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -711,6 +711,20 @@ func Test_mode() call assert_equal('c-cv', g:current_modes) " How to test Ex mode? + " Test mode in operatorfunc (it used to be Operator-pending). + set operatorfunc=OperatorFunc + function OperatorFunc(_) + call Save_mode() + endfunction + execute "normal! g@l\" + call assert_equal('n-n', g:current_modes) + execute "normal! i\g@l\" + call assert_equal('n-niI', g:current_modes) + execute "normal! R\g@l\" + call assert_equal('n-niR', g:current_modes) + execute "normal! gR\g@l\" + call assert_equal('n-niV', g:current_modes) + if has('terminal') term call feedkeys("\N", 'xt') @@ -723,6 +737,8 @@ func Test_mode() iunmap xunmap set complete& + set operatorfunc& + delfunction OperatorFunc endfunc func Test_append() -- cgit