comparison 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
comparison
equal deleted inserted replaced
31098:84ca46887d8a 31099:3396d7f4b580
1773 } 1773 }
1774 1774
1775 if (oap->motion_type == MLINE) 1775 if (oap->motion_type == MLINE)
1776 fix_indent(); 1776 fix_indent();
1777 1777
1778 // Reset finish_op now, don't want it set inside edit().
1779 int save_finish_op = finish_op;
1780 finish_op = FALSE;
1781
1778 retval = edit(NUL, FALSE, (linenr_T)1); 1782 retval = edit(NUL, FALSE, (linenr_T)1);
1783
1784 finish_op = save_finish_op;
1779 1785
1780 /* 1786 /*
1781 * In Visual block mode, handle copying the new text to all lines of the 1787 * In Visual block mode, handle copying the new text to all lines of the
1782 * block. 1788 * block.
1783 * Don't repeat the insert when Insert mode ended with CTRL-C. 1789 * Don't repeat the insert when Insert mode ended with CTRL-C.
3436 static void 3442 static void
3437 op_function(oparg_T *oap UNUSED) 3443 op_function(oparg_T *oap UNUSED)
3438 { 3444 {
3439 #ifdef FEAT_EVAL 3445 #ifdef FEAT_EVAL
3440 typval_T argv[2]; 3446 typval_T argv[2];
3441 int save_virtual_op = virtual_op;
3442 int save_finish_op = finish_op;
3443 pos_T orig_start = curbuf->b_op_start; 3447 pos_T orig_start = curbuf->b_op_start;
3444 pos_T orig_end = curbuf->b_op_end; 3448 pos_T orig_end = curbuf->b_op_end;
3445 typval_T rettv; 3449 typval_T rettv;
3446 3450
3447 if (*p_opfunc == NUL) 3451 if (*p_opfunc == NUL)
3464 argv[0].vval.v_string = (char_u *)"char"; 3468 argv[0].vval.v_string = (char_u *)"char";
3465 argv[1].v_type = VAR_UNKNOWN; 3469 argv[1].v_type = VAR_UNKNOWN;
3466 3470
3467 // Reset virtual_op so that 'virtualedit' can be changed in the 3471 // Reset virtual_op so that 'virtualedit' can be changed in the
3468 // function. 3472 // function.
3473 int save_virtual_op = virtual_op;
3469 virtual_op = MAYBE; 3474 virtual_op = MAYBE;
3470 3475
3471 // Reset finish_op so that mode() returns the right value. 3476 // Reset finish_op so that mode() returns the right value.
3477 int save_finish_op = finish_op;
3472 finish_op = FALSE; 3478 finish_op = FALSE;
3473 3479
3474 if (call_callback(&opfunc_cb, 0, &rettv, 1, argv) != FAIL) 3480 if (call_callback(&opfunc_cb, 0, &rettv, 1, argv) != FAIL)
3475 clear_tv(&rettv); 3481 clear_tv(&rettv);
3476 3482
4111 #ifdef FEAT_LINEBREAK 4117 #ifdef FEAT_LINEBREAK
4112 // Restore linebreak, so that when the user edits it looks as 4118 // Restore linebreak, so that when the user edits it looks as
4113 // before. 4119 // before.
4114 restore_lbr(lbr_saved); 4120 restore_lbr(lbr_saved);
4115 #endif 4121 #endif
4116 // Reset finish_op now, don't want it set inside edit().
4117 finish_op = FALSE;
4118 if (op_change(oap)) // will call edit() 4122 if (op_change(oap)) // will call edit()
4119 cap->retval |= CA_COMMAND_BUSY; 4123 cap->retval |= CA_COMMAND_BUSY;
4120 if (restart_edit == 0) 4124 if (restart_edit == 0)
4121 restart_edit = restart_edit_save; 4125 restart_edit = restart_edit_save;
4122 } 4126 }