From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19741 invoked by alias); 18 Jun 2011 21:32:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29489 Received: (qmail 1092 invoked from network); 18 Jun 2011 21:32:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.56 as permitted sender) Date: Sat, 18 Jun 2011 22:07:23 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: _multi_parts and -q Message-ID: <20110618220723.6559e606@pws-pc.ntlworld.com> In-Reply-To: <110618130334.ZM19744@torch.brasslantern.com> References: <20110617215008.GA3154@lorien.comfychair.org> <20110618205218.093eb2f8@pws-pc.ntlworld.com> <110618130334.ZM19744@torch.brasslantern.com> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=uObrxnre4hsA:10 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=NLZqzBF-AAAA:8 a=o_isRBIt-IbZhqGP54kA:9 a=CjuIK1q_8ugA:10 a=I6wTmPyJxzYA:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Sat, 18 Jun 2011 13:03:34 -0700 Bart Schaefer wrote: On Jun 18, 8:52pm, Peter Stephenson wrote: > } > } _tst() { > } local expl_type="stuff" > } local -a datasetlist > } datasetlist=(foo bar rod stuff) > } local pref > } [[ $PREFIX = */* ]] && pref=${PREFIX%/*} > } [[ -n $pref ]] && datasetlist=($pref/${^datasetlist}) > } _wanted dataset expl "$expl_type" _multi_parts -S/ -q / datasetlist; > } } > } > } simply to get strings to compile. I don't think that should matter. > > I get Danek's reported behavior if the strings in datasetlist actually > contain the separator. Try the above with > > datasetlist=(xy/foo xy/bar yx/rod stuff xy/yx/xy) > > So perhaps Danek's problem is with the input data? I'm seeing something similar with the "xy/" bit with that data, i.e completing "x" produces "xy/" with a non-removable "/". I think the issue is that "xy/foo", "xy/bar" etc. look like a set of ambiguous completions with "xy/" as prefix --- and in *that* case the "/" isn't special, it's just part of the input string. (Possibly you can see some behaviour that disagrees with this hypothesis.) So the reason I wasn't seeing it is that I was only offering completions for the current level, i.e. I'd only be offering "xy", "yx" and "stuff" at this point, after which the "/" is a suffix & separator with the expected behaviour. So if it's possible to generate the completions in that fashion (some more sophisticated variant of the ${PREFIX%/*} business in the function I was using), I think that would be a workaround. It might be possible to wrap _multi_parts so as to get this behaviour generically --- the doc suggests it's deliberate that _multi_parts doesn't have quite the one-component-at-a-time behaviour you'd expect with files. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/