summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-02-28 13:28:38 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-28 13:28:38 +0000
commit5de4c4372d4366bc85cb66efb3e373439b9471c5 (patch)
tree03a6aea2f9b80a06bc66775e4ea88168dd2d148d /src/buffer.c
parentafd4ae35d66b2e7732eceb5ad9f6b4ece6b7c64c (diff)
downloadvim-git-5de4c4372d4366bc85cb66efb3e373439b9471c5.tar.gz
patch 8.2.4483: command completion makes two rounds to collect matchesv8.2.4483
Problem: Command completion makes two rounds to collect matches. Solution: Use a growarray to collect matches. (Yegappan Lakshmanan, closes #9860)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e58087490..8e68d9424 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2814,38 +2814,39 @@ ExpandBufnames(
}
}
- if (p != NULL)
+ if (p == NULL)
+ continue;
+
+ if (round == 1)
{
- if (round == 1)
- ++count;
- else
- {
- if (options & WILD_HOME_REPLACE)
- p = home_replace_save(buf, p);
- else
- p = vim_strsave(p);
+ ++count;
+ continue;
+ }
- if (!fuzzy)
- {
+ 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