about summary refs log tree commit diff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2009-11-21 06:51:14 +0000
committerBart Schaefer <barts@users.sourceforge.net>2009-11-21 06:51:14 +0000
commit6c48ef6b45a6b64280c1cd851b9b9ebb9ed5bc86 (patch)
tree2ed6b68ba47300f28d2fc2ffb851e5eca1f1ac2f /Src/Zle/computil.c
parent6bc88e679a24fb92c2bf57cacf4c3f113f51c12e (diff)
downloadzsh-6c48ef6b45a6b64280c1cd851b9b9ebb9ed5bc86.tar.gz
zsh-6c48ef6b45a6b64280c1cd851b9b9ebb9ed5bc86.tar.xz
zsh-6c48ef6b45a6b64280c1cd851b9b9ebb9ed5bc86.zip
27415: Src/Zle/computil.c: comparguments "*::..." descriptions could step
on sequentially earlier descriptions when completing for a word other than
the last word on the command line.
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index f2837ed93..17d69411d 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2133,6 +2133,23 @@ ca_parse_line(Cadef d, int multi, int first)
 	    if ((adef = state.def = ca_get_arg(d, state.nth)) &&
 		(state.def->type == CAA_RREST ||
 		 state.def->type == CAA_RARGS)) {
+
+		/* Bart 2009/11/17:
+		 * We've reached the "rest" definition.  If at this point
+		 * we already found another definition that describes the
+		 * current word, use that instead.  If not, prep for the
+		 * "narrowing" of scope to only the remaining words.
+		 *
+		 * We can't test ca_laststate.def in the loop conditions
+		 * at the top because this same loop also handles the
+		 * ':*PATTERN:MESSAGE:ACTION' form for multiple arguments
+		 * after an option, which may need to continue scanning.
+		 * There might be an earlier point at which this test can
+		 * be made but tracking it down is not worth the effort.
+		 */
+		if (ca_laststate.def)
+		    break;
+
 		state.inrest = 0;
 		state.opt = (cur == state.nargbeg + 1 &&
 			     (!multi || !*line ||