mirror of
https://github.com/neovim/neovim.git
synced 2025-10-13 21:36:05 +00:00
vim-patch:9.1.1689: CmdlineChanged not triggered by <Del> (#35496)
Problem: CmdlineChanged not triggered by <Del>
Solution: Use STRCMP() instead of STRNCMP()
(Shougo Matsushita)
closes: vim/vim#18101
540480697d
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
@@ -1033,7 +1033,7 @@ static int command_line_check(VimState *state)
|
||||
// cause the command not to be executed.
|
||||
|
||||
if (ccline.cmdbuff != NULL) {
|
||||
s->prev_cmdbuff = xmemdupz(ccline.cmdbuff, (size_t)ccline.cmdpos);
|
||||
s->prev_cmdbuff = xstrdup(ccline.cmdbuff);
|
||||
}
|
||||
|
||||
// Trigger SafeState if nothing is pending.
|
||||
@@ -2827,8 +2827,7 @@ static int command_line_changed(CommandLineState *s)
|
||||
}
|
||||
|
||||
if (ccline.cmdpos != s->prev_cmdpos
|
||||
|| (s->prev_cmdbuff != NULL
|
||||
&& strncmp(s->prev_cmdbuff, ccline.cmdbuff, (size_t)s->prev_cmdpos) != 0)) {
|
||||
|| (s->prev_cmdbuff != NULL && strcmp(s->prev_cmdbuff, ccline.cmdbuff) != 0)) {
|
||||
// Trigger CmdlineChanged autocommands.
|
||||
do_autocmd_cmdlinechanged(s->firstc > 0 ? s->firstc : '-');
|
||||
}
|
||||
|
@@ -2103,6 +2103,17 @@ func Test_Cmdline()
|
||||
\ '0abc1abc2abc3',
|
||||
\ ], g:log)
|
||||
|
||||
" <Del> should trigger CmdlineChanged
|
||||
let g:log = []
|
||||
call feedkeys(":foo\<Left>\<Left>\<Del>\<Del>\<Esc>", 'xt')
|
||||
call assert_equal([
|
||||
\ 'f',
|
||||
\ 'fo',
|
||||
\ 'foo',
|
||||
\ 'fo',
|
||||
\ 'f',
|
||||
\ ], g:log)
|
||||
|
||||
unlet g:log
|
||||
au! CmdlineChanged
|
||||
|
||||
|
Reference in New Issue
Block a user