about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-19 07:00:22 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-20 17:59:20 +0000
commit2c612c5ba10d7278b76e1d05374cc617ed5ad5fc (patch)
tree629b86b71336d0f64132fe74fb95247bb58fe1ff /Src/Zle
parentbd94e13f34db02b0fed2414b54cc6787407436ad (diff)
downloadzsh-2c612c5ba10d7278b76e1d05374cc617ed5ad5fc.tar.gz
zsh-2c612c5ba10d7278b76e1d05374cc617ed5ad5fc.tar.xz
zsh-2c612c5ba10d7278b76e1d05374cc617ed5ad5fc.zip
39383: compadd: Restrict previous patch to the case where $PREFIX includes characters both from the -P prefix and from the (unprefixed) candidate completion word.
Diffstat (limited to 'Src/Zle')
-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;
 		}