To: vim_dev@googlegroups.com Subject: Patch 9.0.0884 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0884 Problem: Mouse shape remains in op-pending mode after failed change. Solution: Reset finish_op and restore it. (closes #11545) Files: src/ops.c, src/testdir/test_normal.vim *** ../vim-9.0.0883/src/ops.c 2022-11-11 22:57:41.774304953 +0000 --- src/ops.c 2022-11-15 13:30:21.449762033 +0000 *************** *** 1775,1782 **** --- 1775,1788 ---- 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,3445 **** { #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; --- 3444,3449 ---- *************** *** 3466,3474 **** --- 3470,3480 ---- // 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,4120 **** // 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) --- 4119,4124 ---- *** ../vim-9.0.0883/src/testdir/test_normal.vim 2022-10-13 20:23:24.438002818 +0100 --- src/testdir/test_normal.vim 2022-11-15 13:26:31.629767161 +0000 *************** *** 3807,3810 **** --- 3807,3843 ---- bwipe! endfunc + " Test that mouse shape is restored to Normal mode after failed "c" operation. + func Test_mouse_shape_after_failed_change() + CheckFeature mouseshape + CheckCanRunGui + + let lines =<< trim END + set mouseshape+=o:busy + setlocal nomodifiable + let g:mouse_shapes = [] + + func SaveMouseShape(timer) + let g:mouse_shapes += [getmouseshape()] + endfunc + + func SaveAndQuit(timer) + call writefile(g:mouse_shapes, 'Xmouseshapes') + quit + endfunc + + call timer_start(50, {_ -> feedkeys('c')}) + call timer_start(100, 'SaveMouseShape') + call timer_start(150, {_ -> feedkeys('c')}) + call timer_start(200, 'SaveMouseShape') + call timer_start(250, 'SaveAndQuit') + END + call writefile(lines, 'Xmouseshape.vim', 'D') + call RunVim([], [], "-g -S Xmouseshape.vim") + sleep 300m + call assert_equal(['busy', 'arrow'], readfile('Xmouseshapes')) + + call delete('Xmouseshapes') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0883/src/version.c 2022-11-14 22:07:41.340221360 +0000 --- src/version.c 2022-11-15 13:28:33.809759433 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 884, /**/ -- "Thou shalt not follow the Null Pointer, for at its end Chaos and Madness lie." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///