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: #18207
closes: #18219

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-06 19:47:45 +02:00
committed by Christian Brabandt
parent 8fec92d631
commit 708ab7f5fb
4 changed files with 46 additions and 8 deletions

View File

@ -1681,6 +1681,7 @@ getcmdline_int(
int wild_type = 0;
int event_cmdlineleavepre_triggered = FALSE;
char_u *prev_cmdbuff = NULL;
int did_hist_navigate = FALSE;
// one recursion level deeper
++depth;
@ -1891,6 +1892,13 @@ getcmdline_int(
c = safe_vgetc();
} while (c == K_IGNORE || c == K_NOP);
// Skip wildmenu during history navigation via Up/Down keys
if (c == K_WILD && did_hist_navigate)
{
did_hist_navigate = FALSE;
continue;
}
if (c == K_COMMAND || c == K_SCRIPT_COMMAND)
{
int clen = ccline.cmdlen;
@ -2489,7 +2497,10 @@ getcmdline_int(
res = cmdline_browse_history(c, firstc, &lookfor, &lookforlen, histype,
&hiscnt, &xpc);
if (res == CMDLINE_CHANGED)
{
did_hist_navigate = TRUE;
goto cmdline_changed;
}
else if (res == GOTO_NORMAL_MODE)
goto returncmd;
}