Skip to content

Commit bf32180

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.0060: Recorded register cannot be translated using keytrans()
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: #13916 closes: #13925 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent cf8695d commit bf32180

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

runtime/syntax/vim.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
" 2024 Jan 23 by Vim Project (add :[23]match commands)
1414
" 2024 Jan 25 by Vim Project (WinNewPre autocommand)
1515
" 2024 Jan 27 by Vim Project (add foreach() function)
16-
" 2024 Jan 28 by Vim Project (improve line-continuation matching)
16+
" 2024 Jan 28 by Vim Project (improve line-continuation matching & string interpolation)
1717
" Version: 9.0-25
1818
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
1919
" Automatically generated keyword lists: {{{1

src/getchar.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,12 +1339,12 @@ gotchars(char_u *chars, int len)
13391339
}
13401340

13411341
/*
1342-
* Record a <Nop> key.
1342+
* Record an <Ignore> key.
13431343
*/
13441344
void
1345-
gotchars_nop(void)
1345+
gotchars_ignore(void)
13461346
{
1347-
char_u nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_NOP };
1347+
char_u nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_IGNORE };
13481348
gotchars(nop_buf, 3);
13491349
}
13501350

@@ -3666,9 +3666,9 @@ vgetorpeek(int advance)
36663666
#endif
36673667
if (timedout && c == ESC)
36683668
{
3669-
// When recording there will be no timeout. Add a <Nop> after the ESC
3670-
// to avoid that it forms a key code with following characters.
3671-
gotchars_nop();
3669+
// When recording there will be no timeout. Add an <Ignore> after the
3670+
// ESC to avoid that it forms a key code with following characters.
3671+
gotchars_ignore();
36723672
}
36733673

36743674
--vgetc_busy;

src/normal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ normal_cmd_get_more_chars(
568568
++no_mapping;
569569
// Vim may be in a different mode when the user types the next key,
570570
// but when replaying a recording the next key is already in the
571-
// typeahead buffer, so record a <Nop> before that to prevent the
572-
// vpeekc() above from applying wrong mappings when replaying.
571+
// typeahead buffer, so record an <Ignore> before that to prevent
572+
// the vpeekc() above from applying wrong mappings when replaying.
573573
++no_u_sync;
574-
gotchars_nop();
574+
gotchars_ignore();
575575
--no_u_sync;
576576
}
577577
}

src/proto/getchar.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int typebuf_changed(int tb_change_cnt);
3030
int typebuf_typed(void);
3131
int typebuf_maplen(void);
3232
void del_typebuf(int len, int offset);
33-
void gotchars_nop(void);
33+
void gotchars_ignore(void);
3434
void ungetchars(int len);
3535
int save_typebuf(void);
3636
void save_typeahead(tasave_T *tp);

src/testdir/test_registers.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,8 @@ func Test_replay_charsearch_omap()
868868
call timer_start(10, {-> feedkeys(",bar\<Esc>q", 't')})
869869
call feedkeys('qrct[', 'xt!')
870870
call assert_equal(',bar[blah]', getline(1))
871+
call assert_equal("ct[\<Ignore>,bar\<Esc>", @r)
872+
call assert_equal('ct[<Ignore>,bar<Esc>', keytrans(@r))
871873
undo
872874
call assert_equal('foo[blah]', getline(1))
873875
call feedkeys('@r', 'xt!')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
60,
707709
/**/
708710
59,
709711
/**/

0 commit comments

Comments
 (0)