Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix for compadd without matching



This makes addmatches() use the right prefix string when it doesn't do 
matching. The cline list built was wrong with dire consequences
(anything from completely wrong strings to endless loops).

Bye
 Sven

--- os/Zle/zle_tricky.c	Fri Feb 19 10:03:56 1999
+++ Src/Zle/zle_tricky.c	Fri Feb 19 10:49:21 1999
@@ -3924,7 +3924,7 @@
 		} else {
 		    e = s;
 		    me = s + sl;
-		    pl = lpl;
+		    pl = sl;
 		}
 		/* Quoting? */
 		if (!(aflags & CAF_QUOTE)) {
@@ -3947,16 +3947,12 @@
 		    Cline *clp = &lc, tlc;
 		    char *ss = dupstring(s), *ee = me + (ss - s);
 
-		    if (lppre && *lppre) {
-			*clp = str_cline(lppre, strlen(lppre), &tlc);
-			clp = &(tlc->next);
-		    }
-		    if (pl) {
-			*clp = str_cline(ss, pl, &tlc);
+		    if (ppre && *ppre) {
+			*clp = str_cline(ppre, strlen(ppre), &tlc);
 			clp = &(tlc->next);
 		    }
 		    if (ee != ss + sl || (lpsuf && *lpsuf)) {
-			*clp = tlc = getcline(ss + pl, (ee - ss) - pl,
+			*clp = tlc = getcline(ss, ee - ss,
 					      NULL, 0, CLF_MID);
 			clp = &(tlc->next);
 			if (ee != ss + sl) {
@@ -3968,7 +3964,7 @@
 			    clp = &(tlc->next);
 			}
 		    } else {
-			*clp = tlc = getcline(NULL, 0, ss + pl, sl - pl,
+			*clp = tlc = getcline(NULL, 0, ss, sl,
 					      CLF_END | CLF_VAR);
 			clp = &(tlc->next);
 		    }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author