From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4734 invoked from network); 3 May 2002 10:52:45 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 3 May 2002 10:52:45 -0000 Received: (qmail 20432 invoked by alias); 3 May 2002 10:52:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17072 Received: (qmail 20420 invoked from network); 3 May 2002 10:52:31 -0000 X-VirusChecked: Checked Date: Fri, 3 May 2002 11:52:00 +0100 From: Oliver Kiddle To: Danek Duvall , Zsh Workers Subject: Re: Bug in _path_files? Message-ID: <20020503105200.GA1110@logica.com> References: <20020502191319.GA2807@lorien.emufarm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020502191319.GA2807@lorien.emufarm.org> User-Agent: Mutt/1.3.28i Sender: Oliver Kiddle On Thu, May 02, 2002 at 12:13:19PM -0700, Danek Duvall wrote: > % cd ~2/^D > functions/ > > The third form is the one I use all the time, but it seems to be wrong > here (it should have the output of the first form). I do have > pushdminus set, but it shouldn't make a difference, although it does. You're right here. It seems to handle pushdminus for that third form yet that form should not be affected by pushdminus. > The following patch fixes my symptoms and is correct as far as I can see > it. The idea being that without the +/-, you should jump directly to The patch looks correct to me. However, it leaves some code that I believe to be redundant (prepending `-' or `+' to $tmp1 only to ignore it by using $tmp1[2,-1]) so I suggest the following patch instead which I think makes the code a bit simpler (hopefully without breaking it). Thanks for the bug report Oliver Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.15 diff -u -r1.15 _path_files --- Completion/Unix/Type/_path_files 16 Apr 2002 08:27:47 -0000 1.15 +++ Completion/Unix/Type/_path_files 3 May 2002 10:41:44 -0000 @@ -224,20 +224,15 @@ realpath="${HOME%/}/" elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then if [[ "$linepath" != [-+]* ]]; then - if [[ -o pushdminus ]]; then - tmp1="-$linepath" - else - tmp1="+$linepath" - fi - else tmp1="$linepath" - fi - if [[ "$linepath" = -* ]]; then - tmp1=$(( $#dirstack $tmp1 )) else - tmp1=$tmp1[2,-1] + if [[ "$linepath" = -* ]]; then + tmp1=$(( $#dirstack $linepath )) + else + tmp1=$linepath[2,-1] + fi + [[ -o pushdminus ]] && tmp1=$(( $#dirstack - $tmp1 )) fi - [[ -o pushdminus ]] && tmp1=$(( $#dirstack - $tmp1 )) if (( ! tmp1 )); then realpath=$PWD/ elif [[ tmp1 -le $#dirstack ]]; then 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.