diff src/ops.c @ 31099:3396d7f4b580 v9.0.0884

patch 9.0.0884: mouse shape remains in op-pending mode after failed change Commit: https://github.com/vim/vim/commit/cdeb65729d96c90320b9009e583ade305c396f29 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Nov 15 13:46:12 2022 +0000 patch 9.0.0884: mouse shape remains in op-pending mode after failed change Problem: Mouse shape remains in op-pending mode after failed change. Solution: Reset finish_op and restore it. (closes https://github.com/vim/vim/issues/11545)
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Nov 2022 15:00:06 +0100
parents 39f96b1e7b8d
children b1c66bff0a66
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -1775,8 +1775,14 @@ op_change(oparg_T *oap)
     if (oap->motion_type == MLINE)
 	fix_indent();
 
+    // Reset finish_op now, don't want it set inside edit().
+    int save_finish_op = finish_op;
+    finish_op = FALSE;
+
     retval = edit(NUL, FALSE, (linenr_T)1);
 
+    finish_op = save_finish_op;
+
     /*
      * In Visual block mode, handle copying the new text to all lines of the
      * block.
@@ -3438,8 +3444,6 @@ op_function(oparg_T *oap UNUSED)
 {
 #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;
     typval_T	rettv;
@@ -3466,9 +3470,11 @@ op_function(oparg_T *oap UNUSED)
 
 	// Reset virtual_op so that 'virtualedit' can be changed in the
 	// function.
+	int save_virtual_op = virtual_op;
 	virtual_op = MAYBE;
 
 	// Reset finish_op so that mode() returns the right value.
+	int save_finish_op = finish_op;
 	finish_op = FALSE;
 
 	if (call_callback(&opfunc_cb, 0, &rettv, 1, argv) != FAIL)
@@ -4113,8 +4119,6 @@ do_pending_operator(cmdarg_T *cap, int o
 		// before.
 		restore_lbr(lbr_saved);
 #endif
-		// Reset finish_op now, don't want it set inside edit().
-		finish_op = FALSE;
 		if (op_change(oap))	// will call edit()
 		    cap->retval |= CA_COMMAND_BUSY;
 		if (restart_edit == 0)