vim-patch:9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged (#22151)

Problem:    CTRL-N and -P on cmdline don't trigger CmdlineChanged.
Solution:   Jump to cmdline_changed instead of cmdline_not_changed.
            (closes vim/vim#11956)

af9e28a5b8

Cherry-pick Test_Cmdline() change from patch 9.0.1039.
This commit is contained in:
zeertzjq 2023-02-07 07:54:33 +08:00 committed by GitHub
parent 3170e05d57
commit 1391385ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 2 deletions

View File

@ -2015,7 +2015,7 @@ static int command_line_handle_key(CommandLineState *s)
if (nextwild(&s->xpc, wild_type, 0, s->firstc != '@') == FAIL) {
break;
}
return command_line_not_changed(s);
return command_line_changed(s);
}
FALLTHROUGH;
@ -2037,7 +2037,7 @@ static int command_line_handle_key(CommandLineState *s)
if (nextwild(&s->xpc, wild_type, 0, s->firstc != '@') == FAIL) {
break;
}
return command_line_not_changed(s);
return command_line_changed(s);
} else {
switch (command_line_browse_history(s)) {
case CMDLINE_CHANGED:

View File

@ -1897,6 +1897,50 @@ func Test_Cmdline()
call assert_equal(':', g:entered)
au! CmdlineChanged
let g:log = []
cnoremap <F1> <Cmd>call setcmdline('ls')<CR>
autocmd CmdlineChanged : let g:log += [getcmdline()]
call feedkeys(":\<F1>", 'xt')
call assert_equal(['ls'], g:log)
unlet g:log
au! CmdlineChanged
cunmap <F1>
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 assert_equal([
\ 's',
\ 'si',
\ 'sig',
\ 'sign',
\ 'sign ',
\ 'sign define',
\ 'sign jump',
\ 'sign list',
\ 'sign jump',
\ 'sign define',
\ 'sign ',
\ ], g:log)
let g:log = []
set wildmenu wildoptions+=pum
call feedkeys(":sign \<S-Tab>\<PageUp>\<kPageUp>\<kPageDown>\<PageDown>\<Esc>", 'xt')
call assert_equal([
\ 's',
\ 'si',
\ 'sig',
\ 'sign',
\ 'sign ',
\ 'sign unplace',
\ 'sign jump',
\ 'sign define',
\ 'sign undefine',
\ 'sign unplace',
\ ], g:log)
set wildmenu& wildoptions&
unlet g:log
au! CmdlineChanged
au! CmdlineEnter : let g:entered = expand('<afile>')
au! CmdlineLeave : let g:left = expand('<afile>')
let g:entered = 0