about summary refs log tree commit diff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-18 09:48:38 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-18 09:48:38 +0000
commitfca4dce5aecbb14ddd2e6b8f0832417c68edc989 (patch)
treef2a85aae395b6c4eaabe84648ca56aefee807595 /Src/Zle/computil.c
parent437294af796f2c1530ef942f53c823ba0753556f (diff)
downloadzsh-fca4dce5aecbb14ddd2e6b8f0832417c68edc989.tar.gz
zsh-fca4dce5aecbb14ddd2e6b8f0832417c68edc989.tar.xz
zsh-fca4dce5aecbb14ddd2e6b8f0832417c68edc989.zip
zsh-workers/8315
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index b2c29d03e..a636ec066 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1043,24 +1043,28 @@ ca_parse_line(Cadef d)
 	    if (!state.def)
 		state.curopt = NULL;
 	} else if (state.arg) {
-	    PERMALLOC {
-		addlinknode(state.args, ztrdup(line));
-	    } LASTALLOC;
+	    if (state.inopt) {
+		state.inopt = 0;
+		state.nargbeg = cur - 1;
+	    }
 	    if ((adef = state.def = ca_get_arg(d, state.nth)) &&
 		(state.def->type == CAA_RREST ||
 		 state.def->type == CAA_RARGS)) {
 		state.inrest = 0;
+		state.argbeg = cur;
 		for (; line; line = compwords[cur++]) {
 		    PERMALLOC {
 			addlinknode(state.args, ztrdup(line));
 		    } LASTALLOC;
 		}
+		memcpy(&ca_laststate, &state, sizeof(state));
+		ca_laststate.ddef = NULL;
+		ca_laststate.doff = 0;
 		break;
 	    }
-	    if (state.inopt) {
-		state.inopt = 0;
-		state.nargbeg = cur - 1;
-	    }
+	    PERMALLOC {
+		addlinknode(state.args, ztrdup(line));
+	    } LASTALLOC;
 	    if (state.def && state.def->type != CAA_NORMAL &&
 		state.def->type != CAA_OPT && state.inarg) {
 		state.restbeg = cur;
@@ -1083,6 +1087,9 @@ ca_parse_line(Cadef d)
 			addlinknode(l, line);
 		    } LASTALLOC;
 		}
+		memcpy(&ca_laststate, &state, sizeof(state));
+		ca_laststate.ddef = NULL;
+		ca_laststate.doff = 0;
 		break;
 	    }
 	}