vim-patch:9.1.1676: completion: long line shown twice

Problem:  completion: long line shown twice
          (Maxim Kim)
Solution: Fix the issue, disable an incorrect test.
          (Girish Palya)

fixes: vim/vim#18035
closes: vim/vim#18088

57379302aa

Omit removal of blank line in Test_noselect_expand_env_var() as it's
added again in patch 9.1.1682.
Cherry-pick two blank lines in Test_long_line_noselect() from patch
9.1.1682.

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-08-24 18:35:11 +08:00
parent a16064ff29
commit 3b5337ab6c
5 changed files with 101 additions and 38 deletions

View File

@@ -1120,14 +1120,11 @@ static int command_line_wildchar_complete(CommandLineState *s)
{
int res;
int options = WILD_NO_BEEP;
bool noselect = (wim_flags[0] & kOptWimFlagNoselect) != 0;
bool noselect = p_wmnu && (wim_flags[0] & kOptWimFlagNoselect) != 0;
if (wim_flags[s->wim_index] & kOptWimFlagLastused) {
options |= WILD_BUFLASTUSED;
}
if (noselect) {
options |= WILD_KEEP_SOLE_ITEM;
}
if (s->xpc.xp_numfiles > 0) { // typed p_wc at least twice
// if 'wildmode' contains "list" may still need to list
if (s->xpc.xp_numfiles > 1
@@ -1164,6 +1161,9 @@ static int command_line_wildchar_complete(CommandLineState *s)
if (wim_flags[0] & kOptWimFlagLongest) {
res = nextwild(&s->xpc, WILD_LONGEST, options, s->firstc != '@');
} else {
if (noselect || (wim_flags[s->wim_index] & kOptWimFlagList)) {
options |= WILD_NOSELECT;
}
res = nextwild(&s->xpc, WILD_EXPAND_KEEP, options, s->firstc != '@');
}
@@ -1188,14 +1188,6 @@ static int command_line_wildchar_complete(CommandLineState *s)
}
if ((wim_flags[s->wim_index] & kOptWimFlagList)
|| (p_wmnu && (wim_flags[s->wim_index] & (kOptWimFlagFull|kOptWimFlagNoselect)))) {
if (!(wim_flags[0] & kOptWimFlagLongest)) {
int p_wmnu_save = p_wmnu;
p_wmnu = 0;
// remove match
nextwild(&s->xpc, WILD_PREV, options, s->firstc != '@');
p_wmnu = p_wmnu_save;
}
showmatches(&s->xpc,
p_wmnu && ((wim_flags[s->wim_index] & kOptWimFlagList) == 0),
noselect);
@@ -1204,9 +1196,6 @@ static int command_line_wildchar_complete(CommandLineState *s)
if (wim_flags[s->wim_index] & kOptWimFlagLongest) {
nextwild(&s->xpc, WILD_LONGEST, options, s->firstc != '@');
} else if ((wim_flags[s->wim_index] & kOptWimFlagFull)
&& !(wim_flags[s->wim_index] & kOptWimFlagNoselect)) {
nextwild(&s->xpc, WILD_NEXT, options, s->firstc != '@');
}
} else {
vim_beep(kOptBoFlagWildmode);