summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-02-25 14:24:44 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-25 14:24:44 +0000
commitd6a4ea3aa0d3f4a886ea900e94bf4e8ca8ae8d63 (patch)
tree08280d9941371f9a9138a61082cb65361931ef04 /src
parent6d611de58c8e324491415da8e79c6bd3faa3e848 (diff)
patch 9.0.1354: "gr CTRL-G" stays in virtual replace modev9.0.1354
Problem: "gr CTRL-G" stays in virtual replace mode. (Pierre Ganty) Solution: Prepend CTRL-V before control characters. (closes #12045)
Diffstat (limited to 'src')
-rw-r--r--src/edit.c4
-rw-r--r--src/normal.c4
-rw-r--r--src/testdir/test_edit.vim8
-rw-r--r--src/version.c2
4 files changed, 16 insertions, 2 deletions
diff --git a/src/edit.c b/src/edit.c
index a030e537a6..ff9fc0ed0f 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3527,6 +3527,10 @@ ins_ctrl_g(void)
dont_sync_undo = MAYBE;
break;
+ case ESC:
+ // Esc after CTRL-G cancels it.
+ break;
+
// Unknown CTRL-G command, reserved for future expansion.
default: vim_beep(BO_CTRLG);
}
diff --git a/src/normal.c b/src/normal.c
index b3ea5e8bca..95bb1a97d6 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5033,6 +5033,10 @@ nv_vreplace(cmdarg_T *cap)
{
if (cap->extra_char == Ctrl_V) // get another character
cap->extra_char = get_literal(FALSE);
+ if (cap->extra_char < ' ')
+ // Prefix a control character with CTRL-V to avoid it being used as
+ // a command.
+ stuffcharReadbuff(Ctrl_V);
stuffcharReadbuff(cap->extra_char);
stuffcharReadbuff(ESC);
if (virtual_active())
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 1b00ae98f9..f0896d2c5c 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -2068,8 +2068,12 @@ endfunc
func Test_edit_gr_special()
enew
call setline(1, ['abcdef', 'xxxxxx'])
- exe "normal! gr\<C-O>x"
- call assert_equal('bcdef', getline(1))
+ exe "normal! gr\<C-O>lx"
+ call assert_equal("\<C-O>def", getline(1))
+
+ call setline(1, 'abcdef')
+ exe "normal! 0gr\<C-G>lx"
+ call assert_equal("\<C-G>def", getline(1))
bwipe!
endfunc
diff --git a/src/version.c b/src/version.c
index c3631e6ccd..315f91eac2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1354,
+/**/
1353,
/**/
1352,