vim-patch:9.1.1738: cmdline-autocompletion breaks history navigation

Problem:  cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
          Palya)

Up/Down arrows support history navigation when using wildtrigger()

fixes: vim/vim#18207
closes: vim/vim#18219

708ab7f5fb

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-08 11:42:27 +08:00
parent a7b8102f20
commit b51eba9273
2 changed files with 32 additions and 0 deletions

View File

@@ -146,6 +146,7 @@ typedef struct {
buf_T *b_im_ptr_buf; ///< buffer where b_im_ptr is valid
int cmdline_type;
bool event_cmdlineleavepre_triggered;
bool did_hist_navigate;
} CommandLineState;
typedef struct {
@@ -1254,6 +1255,12 @@ static int command_line_execute(VimState *state, int key)
CommandLineState *s = (CommandLineState *)state;
s->c = key;
// Skip wildmenu during history navigation via Up/Down keys
if (s->c == K_WILD && s->did_hist_navigate) {
s->did_hist_navigate = false;
return 1;
}
if (s->c == K_EVENT || s->c == K_COMMAND || s->c == K_LUA) {
if (s->c == K_EVENT) {
state_handle_k_event();
@@ -2227,6 +2234,7 @@ static int command_line_handle_key(CommandLineState *s)
} else {
switch (command_line_browse_history(s)) {
case CMDLINE_CHANGED:
s->did_hist_navigate = true;
return command_line_changed(s);
case GOTO_NORMAL_MODE:
return 0;