aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/insexpand.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index adbd2a5315..c2bec8b045 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -3325,24 +3325,10 @@ static void get_next_bufname_token(void)
{
FOR_ALL_BUFFERS(b) {
if (b->b_p_bl && b->b_sfname != NULL) {
- char *start = get_past_head(b->b_sfname);
- char *current = start;
- char *p = (char *)path_next_component(start);
- while (true) {
- int len = (int)(p - current) - (*p == NUL ? 0 : 1);
- // treat . as a separator, unless it is the first char in a filename
- char *dot = strchr(current, '.');
- if (dot && *p == NUL && *current != '.') {
- len = (int)(dot - current);
- p = dot + 1;
- }
- ins_compl_add(current, len, NULL, NULL, false, NULL, 0,
+ char *tail = path_tail(b->b_sfname);
+ if (strncmp(tail, compl_orig_text, strlen(compl_orig_text)) == 0) {
+ ins_compl_add(tail, (int)strlen(tail), NULL, NULL, false, NULL, 0,
p_ic ? CP_ICASE : 0, false);
- if (*p == NUL) {
- break;
- }
- current = p;
- p = (char *)path_next_component(p);
}
}
}