diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/Zle/compcore.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 2a8ba741b..ff313003b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-09-20 Daniel Shahaf <d.s@daniel.shahaf.name> + * 39383: Src/Zle/compcore.c: compadd: Restrict previous patch + to the case where $PREFIX includes characters both from the -P + prefix and from the (unprefixed) candidate completion word. + * 39372: Src/Zle/compcore.c: compadd: Match -P prefix all-or-nothing rather than greedily. 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; } |