From bacc83009bc38c9ba0247aaa22b76d1993d57993 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 12 Aug 2023 00:09:31 +0200 Subject: 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 Co-authored-by: zeertzjq --- src/getchar.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/getchar.c') diff --git a/src/getchar.c b/src/getchar.c index c5ccdf2e0e..6867b59ed7 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1338,6 +1338,16 @@ gotchars(char_u *chars, int len) ++maptick; } +/* + * Record a 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 @@ -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 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; -- cgit v1.2.3