patch 9.0.1694: wrong mapping applied when replaying a char search
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>
diff --git a/src/getchar.c b/src/getchar.c
index c5ccdf2..6867b59 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1339,6 +1339,16 @@
}
/*
+ * 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 @@
#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;