Patch 9.0.1521
Problem: Failing redo of command with control characters.
Solution: Use AppendToRedobuffLit() for colon commands. (closes #12354)
Files: src/getchar.c, src/ops.c, src/testdir/test_normal.vim
*** ../vim-9.0.1520/src/getchar.c 2023-05-06 16:21:59.594537269 +0100
--- src/getchar.c 2023-05-07 17:38:45.151623324 +0100
***************
*** 43,50 ****
static int typeahead_char = 0; // typeahead char that's not flushed
/*
! * when block_redo is TRUE redo buffer will not be changed
! * used by edit() to repeat insertions and 'V' command for redoing
*/
static int block_redo = FALSE;
--- 43,50 ----
static int typeahead_char = 0; // typeahead char that's not flushed
/*
! * When block_redo is TRUE the redo buffer will not be changed.
! * Used by edit() to repeat insertions.
*/
static int block_redo = FALSE;
***************
*** 609,619 ****
void
AppendToRedobuffSpec(char_u *s)
{
while (*s != NUL)
{
if (*s == K_SPECIAL && s[1] != NUL && s[2] != NUL)
{
! // insert special key literally
add_buff(&redobuff, s, 3L);
s += 3;
}
--- 609,622 ----
void
AppendToRedobuffSpec(char_u *s)
{
+ if (block_redo)
+ return;
+
while (*s != NUL)
{
if (*s == K_SPECIAL && s[1] != NUL && s[2] != NUL)
{
! // Insert special key literally.
add_buff(&redobuff, s, 3L);
s += 3;
}
*** ../vim-9.0.1520/src/ops.c 2023-05-06 16:21:59.594537269 +0100
--- src/ops.c 2023-05-07 17:35:20.215570521 +0100
***************
*** 3701,3707 ****
ResetRedobuff();
else
{
! AppendToRedobuffSpec(repeat_cmdline);
AppendToRedobuff(NL_STR);
VIM_CLEAR(repeat_cmdline);
}
--- 3701,3710 ----
ResetRedobuff();
else
{
! if (cap->cmdchar == ':')
! AppendToRedobuffLit(repeat_cmdline, -1);
! else
! AppendToRedobuffSpec(repeat_cmdline);
AppendToRedobuff(NL_STR);
VIM_CLEAR(repeat_cmdline);
}
*** ../vim-9.0.1520/src/testdir/test_normal.vim 2023-03-06 08:09:58.951487769 +0000
--- src/testdir/test_normal.vim 2023-05-07 17:35:20.215570521 +0100
***************
*** 3635,3645 ****
bwipe!
endfunc
! " Test for using a : command in operator pending mode
func Test_normal_colon_op()
new
call setline(1, ['one', 'two'])
call assert_beeps("normal! Gc:d\<CR>")
bwipe!
endfunc
--- 3635,3666 ----
bwipe!
endfunc
! " Test for using a ":" command in operator pending mode
func Test_normal_colon_op()
new
call setline(1, ['one', 'two'])
call assert_beeps("normal! Gc:d\<CR>")
+ call assert_equal(['one'], getline(1, '$'))
+
+ call setline(1, ['one…two…three!'])
+ normal! $
+ " Using ":" as a movement is characterwise exclusive
+ call feedkeys("d:normal! F…\<CR>", 'xt')
+ call assert_equal(['one…two!'], getline(1, '$'))
+ " Check that redoing a command with 0x80 bytes works
+ call feedkeys('.', 'xt')
+ call assert_equal(['one!'], getline(1, '$'))
+
+ call setline(1, ['one', 'two', 'three', 'four', 'five'])
+ " Add this to the command history
+ call feedkeys(":normal! G0\<CR>", 'xt')
+ " Use :normal! with control characters in operator pending mode
+ call feedkeys("d:normal! \<C-V>\<C-P>\<C-V>\<C-P>\<CR>", 'xt')
+ call assert_equal(['one', 'two', 'five'], getline(1, '$'))
+ " Check that redoing a command with control characters works
+ call feedkeys('.', 'xt')
+ call assert_equal(['five'], getline(1, '$'))
+
bwipe!
endfunc
*** ../vim-9.0.1520/src/version.c 2023-05-06 22:21:07.247211940 +0100
--- src/version.c 2023-05-07 17:37:22.787599941 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1521,
/**/
--
hundred-and-one symptoms of being an internet addict:
9. All your daydreaming is preoccupied with getting a faster connection to the
net: cable modem...100 Mbit...Fiber...1Gbit
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///