mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1521: failing redo of command with control characters
Problem: Failing redo of command with control characters.
Solution: Use AppendToRedobuffLit() for colon commands. (closes vim/vim#12354)
30b6d6104c
This commit is contained in:
parent
3233137813
commit
5844af0d52
@ -92,8 +92,8 @@ static buffheader_T readbuf2 = { { NULL, { NUL } }, NULL, 0, 0 };
|
|||||||
|
|
||||||
static int typeahead_char = 0; // typeahead char that's not flushed
|
static int typeahead_char = 0; // typeahead char that's not flushed
|
||||||
|
|
||||||
// when block_redo is true redo buffer will not be changed
|
/// When block_redo is true the redo buffer will not be changed.
|
||||||
// used by edit() to repeat insertions and 'V' command for redoing
|
/// Used by edit() to repeat insertions.
|
||||||
static int block_redo = false;
|
static int block_redo = false;
|
||||||
|
|
||||||
static int KeyNoremap = 0; // remapping flags
|
static int KeyNoremap = 0; // remapping flags
|
||||||
@ -558,6 +558,10 @@ void AppendToRedobuffLit(const char *str, int len)
|
|||||||
/// and escaping other K_SPECIAL bytes.
|
/// and escaping other K_SPECIAL bytes.
|
||||||
void AppendToRedobuffSpec(const char *s)
|
void AppendToRedobuffSpec(const char *s)
|
||||||
{
|
{
|
||||||
|
if (block_redo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (*s != NUL) {
|
while (*s != NUL) {
|
||||||
if ((uint8_t)(*s) == K_SPECIAL && s[1] != NUL && s[2] != NUL) {
|
if ((uint8_t)(*s) == K_SPECIAL && s[1] != NUL && s[2] != NUL) {
|
||||||
// Insert special key literally.
|
// Insert special key literally.
|
||||||
|
@ -5858,7 +5858,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||||||
if (repeat_cmdline == NULL) {
|
if (repeat_cmdline == NULL) {
|
||||||
ResetRedobuff();
|
ResetRedobuff();
|
||||||
} else {
|
} else {
|
||||||
AppendToRedobuffSpec(repeat_cmdline);
|
if (cap->cmdchar == ':') {
|
||||||
|
AppendToRedobuffLit(repeat_cmdline, -1);
|
||||||
|
} else {
|
||||||
|
AppendToRedobuffSpec(repeat_cmdline);
|
||||||
|
}
|
||||||
AppendToRedobuff(NL_STR);
|
AppendToRedobuff(NL_STR);
|
||||||
XFREE_CLEAR(repeat_cmdline);
|
XFREE_CLEAR(repeat_cmdline);
|
||||||
}
|
}
|
||||||
|
@ -3648,11 +3648,32 @@ func Test_horiz_motion()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for using a : command in operator pending mode
|
" Test for using a ":" command in operator pending mode
|
||||||
func Test_normal_colon_op()
|
func Test_normal_colon_op()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two'])
|
call setline(1, ['one', 'two'])
|
||||||
call assert_beeps("normal! Gc:d\<CR>")
|
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!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user