summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-12 00:09:31 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-12 00:09:31 +0200
commitbacc83009bc38c9ba0247aaa22b76d1993d57993 (patch)
treecb8534344967454cd4be03c7c78943103ff02be3 /src/getchar.c
parent2d63e4b3ccc0bb34db21a3c1d024cb114f8c4071 (diff)
patch 9.0.1694: wrong mapping applied when replaying a char searchv9.0.1694
Problem: wrong mapping applied when replaying a char search Solution: Store a NOP after the ESC closes: #12708 closes: #6350 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/getchar.c b/src/getchar.c
index c5ccdf2e0e..6867b59ed7 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1339,6 +1339,16 @@ gotchars(char_u *chars, int len)
}
/*
+ * Record a <Nop> key.
+ */
+ void
+gotchars_nop(void)
+{
+ char_u nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_NOP };
+ gotchars(nop_buf, 3);
+}
+
+/*
* Undo the last gotchars() for "len" bytes. To be used when putting a typed
* character back into the typeahead buffer, thus gotchars() will be called
* again.
@@ -3656,14 +3666,9 @@ vgetorpeek(int advance)
#endif
if (timedout && c == ESC)
{
- char_u nop_buf[3];
-
// When recording there will be no timeout. Add a <Nop> after the ESC
// to avoid that it forms a key code with following characters.
- nop_buf[0] = K_SPECIAL;
- nop_buf[1] = KS_EXTRA;
- nop_buf[2] = KE_NOP;
- gotchars(nop_buf, 3);
+ gotchars_nop();
}
--vgetc_busy;