To: vim_dev@googlegroups.com Subject: Patch 9.0.1385 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1385 Problem: g'Esc is considered an error. Solution: Make g'Esc silently abandon the command. (closes #12110) Files: src/normal.c, src/testdir/test_normal.vim *** ../vim-9.0.1384/src/normal.c 2023-02-26 14:47:20.355108904 +0000 --- src/normal.c 2023-03-05 21:11:54.924449101 +0000 *************** *** 899,905 **** State = MODE_NORMAL; ! if (ca.nchar == ESC) { clearop(oap); if (restart_edit == 0 && goto_im()) --- 899,905 ---- State = MODE_NORMAL; ! if (ca.nchar == ESC || ca.extra_char == ESC) { clearop(oap); if (restart_edit == 0 && goto_im()) *************** *** 984,990 **** #ifdef CURSOR_SHAPE // Redraw the cursor with another shape, if we were in Operator-pending // mode or did a replace command. ! if (prev_finish_op || ca.cmdchar == 'r') { ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE --- 984,991 ---- #ifdef CURSOR_SHAPE // Redraw the cursor with another shape, if we were in Operator-pending // mode or did a replace command. ! if (prev_finish_op || ca.cmdchar == 'r' ! || (ca.cmdchar == 'g' && ca.nchar == 'r')) { ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE *************** *** 5025,5031 **** return; } ! if (checkclearopq(cap->oap) || cap->extra_char == ESC) return; if (!curbuf->b_p_ma) --- 5026,5032 ---- return; } ! if (checkclearopq(cap->oap)) return; if (!curbuf->b_p_ma) *************** *** 5903,5909 **** else #endif // "g^A/g^X": sequentially increment visually selected region ! if (VIsual_active) { cap->arg = TRUE; cap->cmdchar = cap->nchar; --- 5904,5910 ---- else #endif // "g^A/g^X": sequentially increment visually selected region ! if (VIsual_active) { cap->arg = TRUE; cap->cmdchar = cap->nchar; *** ../vim-9.0.1384/src/testdir/test_normal.vim 2023-02-26 14:47:20.359108900 +0000 --- src/testdir/test_normal.vim 2023-03-05 21:11:54.928449103 +0000 *************** *** 2526,2531 **** --- 2526,2533 ---- norm! g'a call assert_equal('>', a[-1:]) call assert_equal(1, line('.')) + call assert_nobeep("normal! g`\") + call assert_nobeep("normal! g'\") " Test for g; and g, norm! g; *************** *** 3305,3311 **** set modifiable& call assert_nobeep("normal! gr\") ! call assert_beeps("normal! cgr\") call assert_equal('zxxxx line l', getline(1)) exe "normal! 2|gr\\" --- 3307,3314 ---- set modifiable& call assert_nobeep("normal! gr\") ! call assert_nobeep("normal! cgr\") ! call assert_beeps("normal! cgrx") call assert_equal('zxxxx line l', getline(1)) exe "normal! 2|gr\\" *************** *** 3920,3924 **** --- 3923,3959 ---- call delete('Xmouseshapes') endfunc + + " Test that mouse shape is restored to Normal mode after cancelling "gr". + func Test_mouse_shape_after_cancelling_gr() + CheckFeature mouseshape + CheckCanRunGui + + let lines =<< trim END + vim9script + var mouse_shapes = [] + + feedkeys('gr') + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + feedkeys("\") + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + writefile(mouse_shapes, 'Xmouseshapes') + quit + }) + }) + }) + }) + END + call writefile(lines, 'Xmouseshape.vim', 'D') + call RunVim([], [], "-g -S Xmouseshape.vim") + sleep 300m + call assert_equal(['beam', 'arrow'], readfile('Xmouseshapes')) + + call delete('Xmouseshapes') + endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.1384/src/version.c 2023-03-05 20:56:32.812085652 +0000 --- src/version.c 2023-03-05 21:13:10.152484063 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1385, /**/ -- Get a life? What is the URL where it can be downloaded? /// 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 ///