diff src/testdir/test_functions.vim @ 26007:1d2e1c23e458 v8.2.3537

patch 8.2.3537: mode() does not return the right value in 'operatorfunc' Commit: https://github.com/vim/vim/commit/75c30e96cf280a8cc01ac01c41a9252db3e503cc Author: naohiro ono <obcat@icloud.com> Date: Tue Oct 19 11:15:41 2021 +0100 patch 8.2.3537: mode() does not return the right value in 'operatorfunc' Problem: mode() does not return the right value in 'operatorfunc'. Solution: Reset finish_op while calling 'operatorfunc'.
author Bram Moolenaar <Bram@vim.org>
date Tue, 19 Oct 2021 12:30:05 +0200
parents a5a772dace5b
children cc95e10e1cf2
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -912,6 +912,20 @@ func Test_mode()
   call assert_equal('c-ce', 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\<Esc>"
+  call assert_equal('n-n', g:current_modes)
+  execute "normal! i\<C-o>g@l\<Esc>"
+  call assert_equal('n-niI', g:current_modes)
+  execute "normal! R\<C-o>g@l\<Esc>"
+  call assert_equal('n-niR', g:current_modes)
+  execute "normal! gR\<C-o>g@l\<Esc>"
+  call assert_equal('n-niV', g:current_modes)
+
   if has('terminal')
     term
     call feedkeys("\<C-W>N", 'xt')
@@ -924,6 +938,8 @@ func Test_mode()
   iunmap <F2>
   xunmap <F2>
   set complete&
+  set operatorfunc&
+  delfunction OperatorFunc
 endfunc
 
 " Test for append()