Patch 8.2.3537
Problem: mode() does not return the right value in 'operatorfunc'.
Solution: Reset finish_op while calling 'operatorfunc'.
Files: src/ops.c, src/testdir/test_functions.vim
*** ../vim-8.2.3536/src/ops.c 2021-09-14 17:55:47.864129826 +0100
--- src/ops.c 2021-10-19 11:14:29.109680066 +0100
***************
*** 3314,3319 ****
--- 3314,3320 ----
#ifdef FEAT_EVAL
typval_T argv[2];
int save_virtual_op = virtual_op;
+ int save_finish_op = finish_op;
pos_T orig_start = curbuf->b_op_start;
pos_T orig_end = curbuf->b_op_end;
***************
*** 3341,3349 ****
--- 3342,3354 ----
// function.
virtual_op = MAYBE;
+ // Reset finish_op so that mode() returns the right value.
+ finish_op = FALSE;
+
(void)call_func_noret(p_opfunc, 1, argv);
virtual_op = save_virtual_op;
+ finish_op = save_finish_op;
if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
curbuf->b_op_start = orig_start;
*** ../vim-8.2.3536/src/testdir/test_functions.vim 2021-10-16
13:00:10.940165406 +0100
--- src/testdir/test_functions.vim 2021-10-19 11:13:05.908465385 +0100
***************
*** 912,917 ****
--- 912,931 ----
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,929 ****
--- 938,945 ----
iunmap <F2>
xunmap <F2>
set complete&
+ set operatorfunc&
+ delfunction OperatorFunc
endfunc
" Test for append()
*** ../vim-8.2.3536/src/version.c 2021-10-18 22:13:53.468428157 +0100
--- src/version.c 2021-10-19 11:14:58.870113933 +0100
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3537,
/**/
--
% cat /usr/include/sys/errno.h
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
[...]
#define EMACS 666 /* Too many macros */
%
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20211019101632.7F852C80053%40moolenaar.net.