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

PATCH: :*<pat>:... patterns



Happy new year...

Such end-patterns in _arguments were ignored it seems (well, not
really ignored, but it was broken in a way that made them be appear as 
if they were ignored).

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Fri Dec 17 21:38:01 1999
+++ Src/Zle/computil.c	Sun Dec 19 22:24:21 1999
@@ -709,9 +709,15 @@
 			p++;
 		    } else if (*p == '*') {
 			if (*++p != ':') {
-			    for (end = ++p; *p && *p != ':'; p++)
+			    char sav;
+
+			    for (end = p++; *p && *p != ':'; p++)
 				if (*p == '\\' && p[1])
 				    p++;
+			    sav = *p;
+			    *p = '\0';
+			    end = dupstring(end);
+			    *p = sav;
 			}
 			if (*p != ':') {
 			    freecadef(ret);
@@ -735,6 +741,8 @@
 		    /* And the definition. */
 
 		    *oargp = parse_caarg(!rest, atype, oanum++, name, &p);
+		    if (end)
+			(*oargp)->end = ztrdup(end);
 		    oargp = &((*oargp)->next);
 		    if (rest)
 			break;
@@ -1081,6 +1089,7 @@
 		if (state.def->end && pattry(endpat, line)) {
 		    state.def = NULL;
 		    state.curopt = NULL;
+		    state.opt = state.arg = 1;
 		    continue;
 		}
 	    } else if ((state.def = state.def->next))
@@ -1218,12 +1227,15 @@
 		    for (; line; line = compwords[cur++])
 			addlinknode(l, ztrdup(line));
 		} LASTALLOC;
-		memcpy(&ca_laststate, &state, sizeof(state));
+		if (cur < compcurrent)
+		    memcpy(&ca_laststate, &state, sizeof(state));
 		ca_laststate.ddef = NULL;
 		ca_laststate.doff = 0;
 		break;
 	    }
-	}
+	} else if (state.def && state.def->end)
+	    endpat = patcompile(state.def->end, 0, NULL);
+
 	/* Copy the state into the global one. */
 
 	if (cur + 1 == compcurrent) {

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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