mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
vim-patch:8.2.4483: command completion makes two rounds to collect matches (#21857)
Problem: Command completion makes two rounds to collect matches.
Solution: Use a growarray to collect matches. (Yegappan Lakshmanan,
closes vim/vim#9860)
5de4c4372d
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -2415,31 +2415,34 @@ int ExpandBufnames(char *pat, int *num_file, char ***file, int options)
|
||||
}
|
||||
}
|
||||
|
||||
if (p != NULL) {
|
||||
if (round == 1) {
|
||||
if (p == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (round == 1) {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (options & WILD_HOME_REPLACE) {
|
||||
p = home_replace_save(buf, p);
|
||||
} else {
|
||||
p = xstrdup(p);
|
||||
}
|
||||
|
||||
if (!fuzzy) {
|
||||
if (matches != NULL) {
|
||||
matches[count].buf = buf;
|
||||
matches[count].match = p;
|
||||
count++;
|
||||
} else {
|
||||
if (options & WILD_HOME_REPLACE) {
|
||||
p = home_replace_save(buf, p);
|
||||
} else {
|
||||
p = xstrdup(p);
|
||||
}
|
||||
|
||||
if (!fuzzy) {
|
||||
if (matches != NULL) {
|
||||
matches[count].buf = buf;
|
||||
matches[count].match = p;
|
||||
count++;
|
||||
} else {
|
||||
(*file)[count++] = p;
|
||||
}
|
||||
} else {
|
||||
fuzmatch[count].idx = count;
|
||||
fuzmatch[count].str = p;
|
||||
fuzmatch[count].score = score;
|
||||
count++;
|
||||
}
|
||||
(*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
|
||||
|
Reference in New Issue
Block a user