diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-29 07:27:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 07:27:15 +0800 |
commit | ba7a52dedc5dd335f22522ec17a0393e068187e3 (patch) | |
tree | c41db10ebafb2bb551b6b3c7a6dd0f3c834907e9 | |
parent | 56ae85a33c57ce276334bbf13c32b4e38b4e4b6b (diff) | |
download | rneovim-ba7a52dedc5dd335f22522ec17a0393e068187e3.tar.gz rneovim-ba7a52dedc5dd335f22522ec17a0393e068187e3.tar.bz2 rneovim-ba7a52dedc5dd335f22522ec17a0393e068187e3.zip |
vim-patch:9.1.0060: Recorded register cannot be translated using keytrans() (#27247)
Problem: Recorded register cannot be translated using keytrans() when
it involves character search (iddqd505)
Solution: Record a K_IGNORE instead of a K_NOP (zeertzjq)
related: vim/vim#13916
closes: vim/vim#13925
https://github.com/vim/vim/commit/bf321806bf44d59f108fd7e5a0eaead04682701d
-rw-r--r-- | src/nvim/getchar.c | 12 | ||||
-rw-r--r-- | src/nvim/normal.c | 6 | ||||
-rw-r--r-- | test/old/testdir/test_registers.vim | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 03bc953368..d3411850fd 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1146,10 +1146,10 @@ static void gotchars(const uint8_t *chars, size_t len) maptick++; } -/// Record a <Nop> key. -void gotchars_nop(void) +/// Record an <Ignore> key. +void gotchars_ignore(void) { - uint8_t nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_NOP }; + uint8_t nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_IGNORE }; gotchars(nop_buf, 3); } @@ -2746,9 +2746,9 @@ static int vgetorpeek(bool advance) } if (timedout && c == ESC) { - // When recording there will be no timeout. Add a <Nop> after the ESC - // to avoid that it forms a key code with following characters. - gotchars_nop(); + // When recording there will be no timeout. Add an <Ignore> after the + // ESC to avoid that it forms a key code with following characters. + gotchars_ignore(); } vgetc_busy--; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index ed2b1437ec..8c388b4318 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -845,10 +845,10 @@ static void normal_get_additional_char(NormalState *s) no_mapping++; // Vim may be in a different mode when the user types the next key, // but when replaying a recording the next key is already in the - // typeahead buffer, so record a <Nop> before that to prevent the - // vpeekc() above from applying wrong mappings when replaying. + // typeahead buffer, so record an <Ignore> before that to prevent + // the vpeekc() above from applying wrong mappings when replaying. no_u_sync++; - gotchars_nop(); + gotchars_ignore(); no_u_sync--; } } diff --git a/test/old/testdir/test_registers.vim b/test/old/testdir/test_registers.vim index bc90de806f..b570e745f1 100644 --- a/test/old/testdir/test_registers.vim +++ b/test/old/testdir/test_registers.vim @@ -829,6 +829,8 @@ func Test_replay_charsearch_omap() call timer_start(10, {-> feedkeys(",bar\<Esc>q", 't')}) call feedkeys('qrct[', 'xt!') call assert_equal(',bar[blah]', getline(1)) + call assert_equal("ct[\<Ignore>,bar\<Esc>", @r) + call assert_equal('ct[<Ignore>,bar<Esc>', keytrans(@r)) undo call assert_equal('foo[blah]', getline(1)) call feedkeys('@r', 'xt!') |