summaryrefslogtreecommitdiff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 05d27068a..5443018d8 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -2194,8 +2194,10 @@ addmatches(Cadata dat, char **argv)
/* Test if there is an existing -P prefix. */
if (dat->pre && *dat->pre) {
int prefix_length = pfxlen(dat->pre, lpre);
- if (dat->pre[prefix_length] == '\0') {
- /* $compadd_args[-P] is a prefix of ${PREFIX}. */
+ if (dat->pre[prefix_length] == '\0' ||
+ lpre[prefix_length] == '\0') {
+ /* $compadd_args[-P] is a prefix of ${PREFIX}, or
+ * vice-versa. */
llpl -= prefix_length;
lpre += prefix_length;
}