From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10096 invoked from network); 23 Aug 1999 12:01:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 23 Aug 1999 12:01:27 -0000 Received: (qmail 22810 invoked by alias); 23 Aug 1999 12:00:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7465 Received: (qmail 22802 invoked from network); 23 Aug 1999 12:00:56 -0000 Date: Mon, 23 Aug 1999 14:00:45 +0200 (MET DST) Message-Id: <199908231200.OAA03141@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 23 Aug 1999 19:54:11 +0900 Subject: Re: PATCH: completion Tanaka Akira wrote: > GNU getopt_long supports the style. > > getopt_long(3): > > The getopt_long() function works like getopt() except that > it also accepts long options, started out by two dashes. > Long option names may be abbreviated if the abbreviation > is unique or is an exact match for some defined option. A > long option may take a parameter, of the form --arg=param > or --arg param. > > So, many GNU commands accept that. Urgh. Sorry, didn't know about that. Hrmpf, do we have to make `_long_options' accept these? Should we join `_arguments' and `_long_options'? Hm. > This is because "-a" in compadd arguments. It is the result of > expansion of "dopts[${(@)^dopts[(I)${ws[1][1]}[$uns]]}]" and > "odopts[${(@)^odopts[(I)${ws[1][1]}[$uns]]}]". Ah, sorry, I didn't test it with `[(I)...]'. So I think this is a real bug, to be fixed in C. I'd like to hear Bart about this, though, because there was explicit code to turn empty array-subscripts into non-arrays. Maybe the effect this had on associations subscripted with `[(I)...]' and `[(R)...]' was pure oversight, though. Bye Sven diff -u os/params.c Src/params.c --- os/params.c Fri Aug 20 15:18:08 1999 +++ Src/params.c Mon Aug 23 13:56:27 1999 @@ -940,7 +940,9 @@ v->isarr |= SCANPM_MATCHVAL; if (down) v->isarr |= SCANPM_MATCHMANY; - if ((ta = getvaluearr(v)) && *ta) { + if ((ta = getvaluearr(v)) && + (*ta || ((v->isarr & SCANPM_MATCHMANY) && + (v->isarr & (SCANPM_MATCHKEY | SCANPM_MATCHVAL))))) { *inv = v->inv; *w = v->b; return 1; @@ -1117,7 +1119,9 @@ } if (*s == ']' || *s == Outbrack) { s++; - if (v->isarr && a == b) + if (v->isarr && a == b && + (!(v->isarr & SCANPM_MATCHMANY) || + !(v->isarr & (SCANPM_MATCHKEY | SCANPM_MATCHVAL)))) v->isarr = 0; v->a = a; v->b = b; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de