mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:9.0.1299: change for triggering incsearch not sufficiently tested
Problem: Change for triggering incsearch not sufficiently tested.
Solution: Add a test case. Simplify the code. (closes vim/vim#11971)
412e0e4ed9
This commit is contained in:
@@ -1626,9 +1626,9 @@ static int command_line_insert_reg(CommandLineState *s)
|
|||||||
ccline.special_char = NUL;
|
ccline.special_char = NUL;
|
||||||
redrawcmd();
|
redrawcmd();
|
||||||
|
|
||||||
// The text has been stuffed, the command line didn't change yet, but it
|
// With "literally": the command line has already changed.
|
||||||
// will change soon. The caller must take care of it.
|
// Else: the text has been stuffed, but the command line didn't change yet.
|
||||||
return literally ? CMDLINE_NOT_CHANGED : CMDLINE_CHANGED;
|
return literally ? CMDLINE_CHANGED : CMDLINE_NOT_CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle the Left and Right mouse clicks in the command-line mode.
|
/// Handle the Left and Right mouse clicks in the command-line mode.
|
||||||
@@ -1862,9 +1862,8 @@ static int command_line_handle_key(CommandLineState *s)
|
|||||||
switch (command_line_insert_reg(s)) {
|
switch (command_line_insert_reg(s)) {
|
||||||
case GOTO_NORMAL_MODE:
|
case GOTO_NORMAL_MODE:
|
||||||
return 0; // back to cmd mode
|
return 0; // back to cmd mode
|
||||||
case CMDLINE_NOT_CHANGED:
|
case CMDLINE_CHANGED:
|
||||||
s->is_state.incsearch_postponed = true;
|
return command_line_changed(s);
|
||||||
FALLTHROUGH;
|
|
||||||
default:
|
default:
|
||||||
return command_line_not_changed(s);
|
return command_line_not_changed(s);
|
||||||
}
|
}
|
||||||
|
@@ -1897,17 +1897,15 @@ func Test_Cmdline()
|
|||||||
call assert_equal(':', g:entered)
|
call assert_equal(':', g:entered)
|
||||||
au! CmdlineChanged
|
au! CmdlineChanged
|
||||||
|
|
||||||
|
autocmd CmdlineChanged : let g:log += [getcmdline()]
|
||||||
|
|
||||||
let g:log = []
|
let g:log = []
|
||||||
cnoremap <F1> <Cmd>call setcmdline('ls')<CR>
|
cnoremap <F1> <Cmd>call setcmdline('ls')<CR>
|
||||||
autocmd CmdlineChanged : let g:log += [getcmdline()]
|
|
||||||
call feedkeys(":\<F1>", 'xt')
|
call feedkeys(":\<F1>", 'xt')
|
||||||
call assert_equal(['ls'], g:log)
|
call assert_equal(['ls'], g:log)
|
||||||
unlet g:log
|
|
||||||
au! CmdlineChanged
|
|
||||||
cunmap <F1>
|
cunmap <F1>
|
||||||
|
|
||||||
let g:log = []
|
let g:log = []
|
||||||
autocmd CmdlineChanged : let g:log += [getcmdline()]
|
|
||||||
call feedkeys(":sign \<Tab>\<Tab>\<C-N>\<C-P>\<S-Tab>\<S-Tab>\<Esc>", 'xt')
|
call feedkeys(":sign \<Tab>\<Tab>\<C-N>\<C-P>\<S-Tab>\<S-Tab>\<Esc>", 'xt')
|
||||||
call assert_equal([
|
call assert_equal([
|
||||||
\ 's',
|
\ 's',
|
||||||
@@ -1938,6 +1936,22 @@ func Test_Cmdline()
|
|||||||
\ 'sign unplace',
|
\ 'sign unplace',
|
||||||
\ ], g:log)
|
\ ], g:log)
|
||||||
set wildmenu& wildoptions&
|
set wildmenu& wildoptions&
|
||||||
|
|
||||||
|
let g:log = []
|
||||||
|
let @r = 'abc'
|
||||||
|
call feedkeys(":0\<C-R>r1\<C-R>\<C-O>r2\<C-R>\<C-R>r3\<Esc>", 'xt')
|
||||||
|
call assert_equal([
|
||||||
|
\ '0',
|
||||||
|
\ '0a',
|
||||||
|
\ '0ab',
|
||||||
|
\ '0abc',
|
||||||
|
\ '0abc1',
|
||||||
|
\ '0abc1abc',
|
||||||
|
\ '0abc1abc2',
|
||||||
|
\ '0abc1abc2abc',
|
||||||
|
\ '0abc1abc2abc3',
|
||||||
|
\ ], g:log)
|
||||||
|
|
||||||
unlet g:log
|
unlet g:log
|
||||||
au! CmdlineChanged
|
au! CmdlineChanged
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user