comparison 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
comparison
equal deleted inserted replaced
26006:412aa3ebb70c 26007:1d2e1c23e458
910 call assert_equal('c-cv', g:current_modes) 910 call assert_equal('c-cv', g:current_modes)
911 call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt') 911 call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt')
912 call assert_equal('c-ce', g:current_modes) 912 call assert_equal('c-ce', g:current_modes)
913 " How to test Ex mode? 913 " How to test Ex mode?
914 914
915 " Test mode in operatorfunc (it used to be Operator-pending).
916 set operatorfunc=OperatorFunc
917 function OperatorFunc(_)
918 call Save_mode()
919 endfunction
920 execute "normal! g@l\<Esc>"
921 call assert_equal('n-n', g:current_modes)
922 execute "normal! i\<C-o>g@l\<Esc>"
923 call assert_equal('n-niI', g:current_modes)
924 execute "normal! R\<C-o>g@l\<Esc>"
925 call assert_equal('n-niR', g:current_modes)
926 execute "normal! gR\<C-o>g@l\<Esc>"
927 call assert_equal('n-niV', g:current_modes)
928
915 if has('terminal') 929 if has('terminal')
916 term 930 term
917 call feedkeys("\<C-W>N", 'xt') 931 call feedkeys("\<C-W>N", 'xt')
918 call assert_equal('n', mode()) 932 call assert_equal('n', mode())
919 call assert_equal('nt', mode(1)) 933 call assert_equal('nt', mode(1))
922 936
923 bwipe! 937 bwipe!
924 iunmap <F2> 938 iunmap <F2>
925 xunmap <F2> 939 xunmap <F2>
926 set complete& 940 set complete&
941 set operatorfunc&
942 delfunction OperatorFunc
927 endfunc 943 endfunc
928 944
929 " Test for append() 945 " Test for append()
930 func Test_append() 946 func Test_append()
931 enew! 947 enew!