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

Re: pws-19: completion problem



Andrej Borsenkow wrote:

> bor@itsrm2:/tools/src/zsh-3.1.5-pws-19%> Src/zsh -f
> itsrm2% cd Completion
> itsrm2% fpath=($PWD/*)
> itsrm2% source Core/compinit 
> itsrm2% cd ..
> itsrm2% ./configure --pre=/to<TAB>
> itsrm2% ./configure --pre=/tools/

Whoa. This happened because ${${a}[(I)foo]} didn't work (with `a'
being an array).

Since multsub() now correctly reports arrays, another bug showed
up. It went like this: multsub() found out the ${a} was an array and
set *isarr=1. This was copied into the value struct in
params.c:1073. Then getindex() was called, which called getarg() and
that looked at v->isarr in params.c:82[68]. And since a value of 1 is
the same as SCANPM_WANTVALS, it set *inv=0 which means that
index-reporting was switched off. Then it did the matching, stored
some number and later when the actual value was got, this resulted in
the matched *string* (and not the index) being expanded.

The patch below makes multsub() set isarr to SCANPM_MATCHMANY, which
is the value used for array-parameters. I can only hope that there are 
no other places where this might cause problems.


Bye
 Sven

--- os/subst.c	Thu May 20 08:32:39 1999
+++ Src/subst.c	Fri May 21 09:02:48 1999
@@ -279,7 +279,7 @@
 	*p = NULL;
 	if (a && mult_isarr) {
 	    *a = r;
-	    *isarr = 1;
+	    *isarr = SCANPM_MATCHMANY;
 	    mult_isarr = omi;
 	    return 0;
 	}

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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