diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-26 14:47:24 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-02-26 14:47:24 +0000 |
commit | 4f026ea9f1ad9db262f0dba522768c84e5ae37b4 (patch) | |
tree | f2f9744ff7341c7dd0a7f69a032eb36956ab7273 /src/edit.c | |
parent | 83ae6150bf6bd313487b3a51f9be9836e8b9c20f (diff) |
patch 9.0.1356: cannot cancel "gr" with Escv9.0.1356
Problem: Cannot cancel "gr" with Esc.
Solution: Make "gr<Esc>" do nothing. (closes #12064)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/edit.c b/src/edit.c index ff9fc0ed0f..212efae3d4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -45,7 +45,7 @@ static void ins_ctrl_(void); #endif static int ins_start_select(int c); static void ins_insert(int replaceState); -static void ins_ctrl_o(int cmdchar); +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); @@ -429,8 +429,7 @@ edit( /* * Main loop in Insert mode: repeat until Insert mode is left. */ - int did_loop = FALSE; - for (;; did_loop = TRUE) + for (;;) { #ifdef FEAT_RIGHTLEFT if (!revins_legal) @@ -589,8 +588,6 @@ edit( if (cmdchar == K_PS) // Got here from normal mode when bracketed paste started. c = K_PS; - else if (cmdchar == 'v' && did_loop && count <= 0) - c = ESC; // in case the stuffed Esc was consumed already else do { @@ -720,7 +717,7 @@ edit( { if (c == Ctrl_O) { - ins_ctrl_o(cmdchar); + ins_ctrl_o(); ins_at_eol = FALSE; // cursor keeps its column nomove = TRUE; } @@ -863,7 +860,7 @@ doESCkey: #endif if (echeck_abbr(Ctrl_O + ABBR_OFF)) break; - ins_ctrl_o(cmdchar); + ins_ctrl_o(); // don't move the cursor left when 'virtualedit' has "onemore". if (get_ve_flags() & VE_ONEMORE) @@ -3855,10 +3852,8 @@ ins_insert(int replaceState) * Pressed CTRL-O in Insert mode. */ static void -ins_ctrl_o(int cmdchar) +ins_ctrl_o(void) { - if (cmdchar == 'v') - return; // abort replacing one char for gr CTRL-O if (State & VREPLACE_FLAG) restart_edit = 'V'; else if (State & REPLACE_FLAG) |