0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4483: command completion makes two rounds to collect matches

Problem:    Command completion makes two rounds to collect matches.
Solution:   Use a growarray to collect matches. (Yegappan Lakshmanan,
            closes #9860)
This commit is contained in:
Yegappan Lakshmanan
2022-02-28 13:28:38 +00:00
committed by Bram Moolenaar
parent afd4ae35d6
commit 5de4c4372d
5 changed files with 256 additions and 221 deletions

View File

@@ -2814,38 +2814,39 @@ ExpandBufnames(
}
}
if (p != NULL)
{
if (round == 1)
++count;
else
{
if (options & WILD_HOME_REPLACE)
p = home_replace_save(buf, p);
else
p = vim_strsave(p);
if (p == NULL)
continue;
if (!fuzzy)
{
if (round == 1)
{
++count;
continue;
}
if (options & WILD_HOME_REPLACE)
p = home_replace_save(buf, p);
else
p = vim_strsave(p);
if (!fuzzy)
{
#ifdef FEAT_VIMINFO
if (matches != NULL)
{
matches[count].buf = buf;
matches[count].match = p;
count++;
}
else
#endif
(*file)[count++] = p;
}
else
{
fuzmatch[count].idx = count;
fuzmatch[count].str = p;
fuzmatch[count].score = score;
count++;
}
if (matches != NULL)
{
matches[count].buf = buf;
matches[count].match = p;
count++;
}
else
#endif
(*file)[count++] = p;
}
else
{
fuzmatch[count].idx = count;
fuzmatch[count].str = p;
fuzmatch[count].score = score;
count++;
}
}
if (count == 0) // no match found, break here