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

Re: PATCH: Redo _zle using _arguments



Bart Schaefer wrote:

> On Oct 4,  2:47pm, Sven Wischnowsky wrote:
> } 
> } Bart Schaefer wrote:
> } 
> } > I also suspect there may be a bug in comparguments -- the '(*)-x' form of
> } > optspec is supposed to mean that the '*:msg:act' form is not completed
> } > when -x is on the command line, but that doesn't seem to happen (or at
> } > least, not always).
> } 
> } Hm, I had a look but couldn't find a bug. Could you give me an example?
> 
> Sure.  Completion after "zle -R -c":
> 
> zagzig[501] zle -R -c <TAB>
> Completing status line
> Completing strings to list
> 
> The call to _arguments was:
> 
>       _arguments -s \
>         "-R[redisplay]" \
> 	"(*)-c[clear listing]" \
> 	"(-)::status line: " "*:strings to list: "

Aha. In combination with an optional argument. Right, it was used the
rest-spec even though that was inactivated.

Bye
 Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.42
diff -u -r1.42 computil.c
--- Src/Zle/computil.c	2000/08/14 08:16:45	1.42
+++ Src/Zle/computil.c	2000/10/05 08:52:07
@@ -1685,7 +1685,8 @@
 
 	if (!opt) {
 	    if (arg->num >= 0 && !arg->next && miss)
-		arg = ca_laststate.d->rest;
+		arg = (ca_laststate.d->rest && ca_laststate.d->rest->active ?
+		       ca_laststate.d->rest : NULL);
 	    else {
 		onum = arg->num;
 		rest = (onum != arg->min && onum == ca_laststate.nth);
@@ -1693,7 +1694,8 @@
 		    if (arg->num != onum + 1)
 			miss = 1;
 		} else if (rest || (oopt > 0 && !opt)) {
-		    arg = ca_laststate.d->rest;
+		    arg = (ca_laststate.d->rest && ca_laststate.d->rest->active ?
+			   ca_laststate.d->rest : NULL);
 		    oopt = -1;
 		}
 	    }
@@ -1711,7 +1713,8 @@
     }
     if (!opt && oopt > 0) {
 	oopt = -1;
-	arg = ca_laststate.d->rest;
+	arg = (ca_laststate.d->rest && ca_laststate.d->rest->active ?
+	       ca_laststate.d->rest : NULL);
 
 	goto rec;
     }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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