about summary refs log tree commit diff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index a7752967c..48189ab31 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -307,7 +307,6 @@ do_completion(Hookdef dummy, Compldat dat)
     hasmatched = hasunmatched = 0;
     minmlen = 1000000;
     maxmlen = -1;
-    compignored = 0;
 
     /* Make sure we have the completion list and compctl. */
     if (makecomplist(s, incmd, lst)) {
@@ -1464,7 +1463,7 @@ addmatches(Cadata dat, char **argv)
     int lpl, lsl, pl, sl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
     int ppl = 0, psl = 0;
     int llpl = 0, llsl = 0, nm = mnum, gflags = 0, ohp = haspattern;
-    int isexact, doadd, ois = instring, oib = inbackt;
+    int oisalt = 0, isalt, isexact, doadd, ois = instring, oib = inbackt;
     Cline lc = NULL, pline = NULL, sline = NULL;
     Cmatch cm;
     struct cmlist mst;
@@ -1744,6 +1743,7 @@ addmatches(Cadata dat, char **argv)
 	    } else
 		dat->prpre = dupstring(dat->prpre);
 	    /* Select the set of matches. */
+	    oisalt = (dat->aflags & CAF_ALT);
 
 	    if (dat->remf) {
 		dat->remf = dupstring(dat->remf);
@@ -1761,7 +1761,7 @@ addmatches(Cadata dat, char **argv)
 	/* Walk through the matches given. */
 	obpl = bpl;
 	obsl = bsl;
-	if (aign || pign) {
+	if (!oisalt && (aign || pign)) {
 	    int max = 0;
 	    char **ap = argv;
 
@@ -1780,8 +1780,9 @@ addmatches(Cadata dat, char **argv)
 		    disp = NULL;
 	    }
 	    sl = strlen(s);
-	    if (aign || pign) {
-		int il = ppl + sl + psl, addit = 1;
+	    isalt = oisalt;
+	    if (!isalt && (aign || pign)) {
+		int il = ppl + sl + psl;
 
 		if (ppl)
 		    memcpy(ibuf, dat->ppre, ppl);
@@ -1795,19 +1796,15 @@ addmatches(Cadata dat, char **argv)
 		    char **pt = aign;
 		    int filell;
 
-		    for (; addit && *pt; pt++)
-			addit = !((filell = strlen(*pt)) < il &&
-				  !strcmp(*pt, ibuf + il - filell));
+		    for (isalt = 0; !isalt && *pt; pt++)
+			isalt = ((filell = strlen(*pt)) < il &&
+				 !strcmp(*pt, ibuf + il - filell));
 		}
-		if (addit && pign) {
+		if (!isalt && pign) {
 		    Patprog *pt = pign;
 
-		    for (; addit && *pt; pt++)
-			addit = !pattry(*pt, ibuf);
-		}
-		if (!addit) {
-		    compignored++;
-		    continue;
+		    for (isalt = 0; !isalt && *pt; pt++)
+			isalt = pattry(*pt, ibuf);
 		}
 	    }
 	    if (!(dat->aflags & CAF_MATCH)) {
@@ -1835,7 +1832,7 @@ addmatches(Cadata dat, char **argv)
 		for (bp = obsl; bp; bp = bp->next)
 		    bp->curpos += bsadd;
 
-		if ((cm = add_match_data(0, ms, lc, dat->ipre, NULL,
+		if ((cm = add_match_data(isalt, ms, lc, dat->ipre, NULL,
 					 dat->isuf, dat->pre, dat->prpre,
 					 dat->ppre, pline,
 					 dat->psuf, sline,
@@ -2178,8 +2175,6 @@ add_match_data(int alt, char *str, Cline line,
 
     newmatches = 1;
     mgroup->new = 1;
-    if (alt)
-	compignored++;
 
     if (!complastprompt || !*complastprompt)
 	dolastprompt = 0;