vim-patch:9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pum

Problem:  Memory leak with wildmode=longest,full and wildoptions=pum
          (after 9.1.1737).
Solution: Avoid using showmatches() and WILD_NEXT together.  Also fix
          wildmode=longest,noselect:full selecting wrong item
          (zeertzjq).

fixes: vim/vim#18228
closes: vim/vim#18229

c7f235bd43
This commit is contained in:
zeertzjq
2025-09-08 08:15:54 +08:00
parent d784ed7013
commit 18f24b85c3
3 changed files with 53 additions and 9 deletions

View File

@@ -1188,13 +1188,11 @@ static int command_line_wildchar_complete(CommandLineState *s)
bool wim_full_next = (wim_flags[1] & kOptWimFlagFull);
bool wim_noselect_next = (wim_flags[1] & kOptWimFlagNoselect);
if (wim_list_next || (p_wmnu && (wim_full_next || wim_noselect_next))) {
if (wim_noselect_next) {
options |= WILD_NOSELECT;
}
if (wim_full_next || wim_noselect_next) {
if (wim_full_next && !wim_noselect_next) {
nextwild(&s->xpc, WILD_NEXT, options, escape);
} else {
showmatches(&s->xpc, p_wmnu, wim_list_next, wim_noselect_next);
}
showmatches(&s->xpc, p_wmnu, wim_list_next, wim_noselect_next);
if (wim_list_next) {
s->did_wild_list = true;
}