aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/edit.c5
-rw-r--r--src/nvim/getchar.c7
-rw-r--r--src/nvim/testdir/Makefile3
-rw-r--r--src/nvim/testdir/test_insertcount.in14
-rw-r--r--src/nvim/testdir/test_insertcount.ok3
-rw-r--r--src/nvim/version.c2
6 files changed, 30 insertions, 4 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 10bee8023e..b3f4e4d449 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -6919,8 +6919,9 @@ ins_esc (
State &= ~REPLACE_FLAG;
(void)start_redo_ins();
- if (cmdchar == 'r' || cmdchar == 'v')
- stuffReadbuff(ESC_STR); /* no ESC in redo buffer */
+ if (cmdchar == 'r' || cmdchar == 'v') {
+ stuffRedoReadbuff(ESC_STR); // No ESC in redo buffer
+ }
++RedrawingDisabled;
disabled_redraw = TRUE;
return FALSE; /* repeat the insert */
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 6c772a8a66..0d61172d69 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -601,6 +601,13 @@ void stuffReadbuff(char_u *s)
add_buff(&readbuf1, s, -1L);
}
+/// Append string "s" to the redo stuff buffer.
+/// @remark CSI and K_SPECIAL must already have been escaped.
+void stuffRedoReadbuff(char_u *s)
+{
+ add_buff(&readbuf2, s, -1L);
+}
+
void stuffReadbuffLen(char_u *s, long len)
{
add_buff(&readbuf1, s, len);
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 92fd47ff6b..81dc49e800 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -33,7 +33,8 @@ SCRIPTS := test_autoformat_join.out \
test106.out test107.out \
test_options.out \
test_listlbr.out test_listlbr_utf8.out \
- test_breakindent.out
+ test_breakindent.out \
+ test_insertcount.out
SCRIPTS_GUI := test16.out
diff --git a/src/nvim/testdir/test_insertcount.in b/src/nvim/testdir/test_insertcount.in
new file mode 100644
index 0000000000..7a40573e63
--- /dev/null
+++ b/src/nvim/testdir/test_insertcount.in
@@ -0,0 +1,14 @@
+Tests for repeating insert and replace.
+
+STARTTEST
+:so small.vim
+:/Second
+4gro
+:/^First/,$wq! test.out
+:" get here when failed and in Insert mode
+:.wq! test.out
+ENDTEST
+
+First line
+Second line
+Last line
diff --git a/src/nvim/testdir/test_insertcount.ok b/src/nvim/testdir/test_insertcount.ok
new file mode 100644
index 0000000000..57afab00ff
--- /dev/null
+++ b/src/nvim/testdir/test_insertcount.ok
@@ -0,0 +1,3 @@
+First line
+ooooecond line
+Last line
diff --git a/src/nvim/version.c b/src/nvim/version.c
index fc0b85fde9..db7f294a88 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -208,7 +208,7 @@ static int included_patches[] = {
//390,
//389,
388,
- //387,
+ 387,
//386,
//385,
//384 NA