diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-12 06:50:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-12 06:50:52 +0800 |
commit | 72cf94fc0e69b7a049ae2990572876d641cf5cb9 (patch) | |
tree | 8db245af9fb892df25fd175f19c6ab03006ee3fe /src/nvim/getchar.c | |
parent | 8c5d81997e56a72fbb1392846a146cab2eb74b7f (diff) | |
download | rneovim-72cf94fc0e69b7a049ae2990572876d641cf5cb9.tar.gz rneovim-72cf94fc0e69b7a049ae2990572876d641cf5cb9.tar.bz2 rneovim-72cf94fc0e69b7a049ae2990572876d641cf5cb9.zip |
vim-patch:9.0.1694: wrong mapping applied when replaying a char search (#24670)
Problem: wrong mapping applied when replaying a char search
Solution: Store a NOP after the ESC
closes: vim/vim#12708
closes: vim/vim#6350
https://github.com/vim/vim/commit/bacc83009bc38c9ba0247aaa22b76d1993d57993
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 5c1366c5b2..2e584e7cff 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1147,6 +1147,13 @@ static void gotchars(const uint8_t *chars, size_t len) maptick++; } +/// Record a <Nop> key. +void gotchars_nop(void) +{ + uint8_t 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. @@ -2745,14 +2752,9 @@ static int vgetorpeek(bool advance) } if (timedout && c == ESC) { - uint8_t 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--; |