0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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>
This commit is contained in:
zeertzjq
2023-08-12 00:09:31 +02:00
committed by Christian Brabandt
parent 2d63e4b3cc
commit bacc83009b
5 changed files with 64 additions and 24 deletions

View File

@@ -1338,6 +1338,16 @@ gotchars(char_u *chars, int len)
++maptick;
}
/*
* 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
@@ -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;