vim-patch:9.1.1737: Patch v9.1.1714 introduce a regression for wildmenu

Problem:  Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq)
Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya)

- Fixed a regression caused by PR vim/vim#18125 selecting wrong item
- Fixed another regression where the first pasted text did not appear on
  the command-line after starting Vim.

closes: vim/vim#18212

8fec92d631

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-07 13:17:29 +08:00
parent 1359578abb
commit f2bda1effc
3 changed files with 150 additions and 22 deletions

View File

@@ -1179,16 +1179,25 @@ static int command_line_wildchar_complete(CommandLineState *s)
// Display matches
if (res == OK && s->xpc.xp_numfiles > (wim_noselect ? 0 : 1)) {
// If "longest" fails to identify the longest item, try other
// 'wim' values if available
if (wim_longest && ccline.cmdpos == cmdpos_before) {
if (wim_full) {
nextwild(&s->xpc, WILD_NEXT, options, escape);
}
if (wim_longest) {
bool found_longest_prefix = (ccline.cmdpos != cmdpos_before);
if (wim_list || (p_wmnu && wim_full)) {
showmatches(&s->xpc, p_wmnu, wim_list, false);
showmatches(&s->xpc, p_wmnu, wim_list, true);
} else if (!found_longest_prefix) {
bool wim_list_next = (wim_flags[1] & kOptWimFlagList);
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) {
nextwild(&s->xpc, WILD_NEXT, options, escape);
}
showmatches(&s->xpc, p_wmnu, wim_list_next, wim_noselect_next);
}
}
} else if (!wim_longest) {
} else {
if (wim_list || (p_wmnu && (wim_full || wim_noselect))) {
showmatches(&s->xpc, p_wmnu, wim_list, wim_noselect);
} else {