From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20103 invoked from network); 19 Feb 2003 08:02:37 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Feb 2003 08:02:37 -0000 Received: (qmail 29382 invoked by alias); 19 Feb 2003 08:02:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18262 Received: (qmail 29374 invoked from network); 19 Feb 2003 08:02:25 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Feb 2003 08:02:25 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Feb 2003 8:2:24 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1045641568!848 Received: (qmail 30428 invoked from network); 19 Feb 2003 07:59:28 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-4.tower-27.messagelabs.com with SMTP; 19 Feb 2003 07:59:28 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id IAA25972 for ; Wed, 19 Feb 2003 08:02:25 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1J85vg06218 for ; Wed, 19 Feb 2003 09:05:57 +0100 To: zsh-workers@sunsite.dk (Zsh hackers list) In-reply-to: <2098.1045227503@csr.com> From: Oliver Kiddle References: <2098.1045227503@csr.com> Subject: PATCH: Re: use of `expand suffix' style in _multi_parts Date: Wed, 19 Feb 2003 09:05:57 +0100 Message-ID: <6216.1045641957@finches.logica.co.uk> Sender: kiddleo@logica.com On 14 Feb, Peter wrote: > Completing directories after > > tar xvzf file.tar.gz HERE/ > > with the `expand' style set to include `suffix' is inconvenient as it > appends a space after the slash when completing the directory HERE. > This is obviously wrong --- there is no reason to do anything other than > normal file completion at this point, irrespective of styles. > > I can fix this by setting `expand' specially for the tar command, of course. > However, it needs fixing more generally. Unfortunately I can't work out > what's actually wrong. The culprit is _multi_parts where the style is > tested. Is this wrong, is the compadd on the next line (which uses the > options passed rather than the separator passed) warong, is _tar wrong, > in any case what needs changing? using: compdef '_multi_parts / "(HERE/ HERE/one HERE/two)"' foo is enough to show the problem so it certainly isn't _tar. If you rearrange the three matches, it is always the first one that is completed. This line in the trace output then looks suspicious: +_multi_parts:94> compadd -O tmp1 -M 'r:|/=* r:|=* ' - HERE HERE HERE It is followed by assertions being made based upon $#tmp1. So for the part it is looking at there are three matches but they are all the same. This patch fixes the problem by adding all those matches. Oliver Index: Completion/Base/Utility/_multi_parts =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_multi_parts,v retrieving revision 1.4 diff -u -r1.4 _multi_parts --- Completion/Base/Utility/_multi_parts 31 May 2001 07:17:04 -0000 1.4 +++ Completion/Base/Utility/_multi_parts 19 Feb 2003 07:55:41 -0000 @@ -114,7 +114,7 @@ if [[ $#imm -ne 0 && $#matches -eq 1 ]] || zstyle -t ":completion:${curcontext}:" expand suffix; then compadd "$group[@]" "$expl[@]" "$sopts[@]" \ - -M "r:|${sep}=* r:|=* $matcher" - "$pref$matches[1]" + -M "r:|${sep}=* r:|=* $matcher" - $pref$matches else if (( $matches[(I)${tmp1[1]}${sep}*] )); then compadd "$group[@]" "$expl[@]" -p "$pref" -r "$sep" -S "$sep" "$opts[@]" \ This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.