about summary refs log tree commit diff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-04 08:35:44 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-04 08:35:44 +0000
commit7ce9bfda5234752a89e46cd85fe5462570b63605 (patch)
treeb3a6f64e122f3a9e86c96e4cb7cbf84197b0e9bf /Src/Zle/computil.c
parentfa435830e721904c4d17e0e18ede59ff59e35973 (diff)
downloadzsh-7ce9bfda5234752a89e46cd85fe5462570b63605.tar.gz
zsh-7ce9bfda5234752a89e46cd85fe5462570b63605.tar.xz
zsh-7ce9bfda5234752a89e46cd85fe5462570b63605.zip
zsh-workers/9187
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 15212acd6..bfcaa4b22 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -709,9 +709,15 @@ parse_cadef(char *nam, char **args)
 			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 @@ parse_cadef(char *nam, char **args)
 		    /* 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 @@ ca_parse_line(Cadef d)
 		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 @@ ca_parse_line(Cadef d)
 		    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) {