summaryrefslogtreecommitdiff
path: root/Src/Zle/complete.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/complete.c')
-rw-r--r--Src/Zle/complete.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index b8db18b1f..e246e2b8a 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -821,6 +821,8 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
add = -1;
} else {
p = compprefix + 1 + (*compprefix == Meta);
+ if (p > compprefix + l)
+ p = compprefix + l;
add = 1;
}
for (;;) {
@@ -833,10 +835,9 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
if (add > 0) {
if (p == compprefix + l)
return 0;
- if (*p == Meta)
- p += 2;
- else
- p++;
+ p = p + 1 + (*p == Meta);
+ if (p > compprefix + l)
+ p = compprefix + l;
} else {
if (p == compprefix)
return 0;