To: vim_dev@googlegroups.com Subject: Patch 9.0.1347 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1347 Problem: "gr CTRL-O" stays in Insert mode. (Pierre Ganty) Solution: Do not set restart_edit when "cmdchar" is 'v'. (closes #12045) Files: src/edit.c, src/testdir/test_edit.vim *** ../vim-9.0.1346/src/edit.c 2023-02-21 14:27:34.516360384 +0000 --- src/edit.c 2023-02-23 20:08:57.235654401 +0000 *************** *** 45,51 **** #endif static int ins_start_select(int c); static void ins_insert(int replaceState); ! static void ins_ctrl_o(void); static void ins_shift(int c, int lastc); static void ins_del(void); static int ins_bs(int c, int mode, int *inserted_space_p); --- 45,51 ---- #endif static int ins_start_select(int c); static void ins_insert(int replaceState); ! static void ins_ctrl_o(int cmdchar); static void ins_shift(int c, int lastc); static void ins_del(void); static int ins_bs(int c, int mode, int *inserted_space_p); *************** *** 429,435 **** /* * Main loop in Insert mode: repeat until Insert mode is left. */ ! for (;;) { #ifdef FEAT_RIGHTLEFT if (!revins_legal) --- 429,436 ---- /* * Main loop in Insert mode: repeat until Insert mode is left. */ ! int did_loop = FALSE; ! for (;; did_loop = TRUE) { #ifdef FEAT_RIGHTLEFT if (!revins_legal) *************** *** 588,593 **** --- 589,596 ---- if (cmdchar == K_PS) // Got here from normal mode when bracketed paste started. c = K_PS; + else if (cmdchar == 'v' && did_loop) + c = ESC; // in case the stuffed Esc was consumed already else do { *************** *** 717,723 **** { if (c == Ctrl_O) { ! ins_ctrl_o(); ins_at_eol = FALSE; // cursor keeps its column nomove = TRUE; } --- 720,726 ---- { if (c == Ctrl_O) { ! ins_ctrl_o(cmdchar); ins_at_eol = FALSE; // cursor keeps its column nomove = TRUE; } *************** *** 860,866 **** #endif if (echeck_abbr(Ctrl_O + ABBR_OFF)) break; ! ins_ctrl_o(); // don't move the cursor left when 'virtualedit' has "onemore". if (get_ve_flags() & VE_ONEMORE) --- 863,869 ---- #endif if (echeck_abbr(Ctrl_O + ABBR_OFF)) break; ! ins_ctrl_o(cmdchar); // don't move the cursor left when 'virtualedit' has "onemore". if (get_ve_flags() & VE_ONEMORE) *************** *** 3848,3855 **** * Pressed CTRL-O in Insert mode. */ static void ! ins_ctrl_o(void) { if (State & VREPLACE_FLAG) restart_edit = 'V'; else if (State & REPLACE_FLAG) --- 3851,3860 ---- * Pressed CTRL-O in Insert mode. */ static void ! ins_ctrl_o(int cmdchar) { + if (cmdchar == 'v') + return; // abort replacing one char for gr CTRL-O if (State & VREPLACE_FLAG) restart_edit = 'V'; else if (State & REPLACE_FLAG) *** ../vim-9.0.1346/src/testdir/test_edit.vim 2023-01-28 19:18:56.729720605 +0000 --- src/testdir/test_edit.vim 2023-02-23 20:12:09.526814021 +0000 *************** *** 2064,2069 **** --- 2064,2079 ---- bwipe! endfunc + " Test "gr" followed by an Insert mode command does get out of Insert mode. + func Test_edit_gr_special() + enew + call setline(1, ['abcdef', 'xxxxxx']) + exe "normal! gr\x" + call assert_equal('bcdef', getline(1)) + + bwipe! + endfunc + " Weird long file name was going over the end of NameBuff func Test_edit_overlong_file_name() CheckUnix *** ../vim-9.0.1346/src/version.c 2023-02-23 15:38:45.332355557 +0000 --- src/version.c 2023-02-23 20:04:03.461606456 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1347, /**/ -- hundred-and-one symptoms of being an internet addict: 171. You invent another person and chat with yourself in empty chat rooms. /// 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 ///