From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12350 invoked from network); 2 Jun 2008 17:03:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Jun 2008 17:03:05 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 20850 invoked from network); 2 Jun 2008 17:03:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Jun 2008 17:03:00 -0000 Received: (qmail 21078 invoked by alias); 2 Jun 2008 17:02:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25129 Received: (qmail 21063 invoked from network); 2 Jun 2008 17:02:57 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 2 Jun 2008 17:02:57 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 0526880589A4 for ; Mon, 2 Jun 2008 19:02:53 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly20g.srv.mailcontrol.com (MailControl) with ESMTP id m52H2kbk009549 for ; Mon, 2 Jun 2008 18:02:46 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Mon, 2 Jun 2008 18:02:45 +0100 Date: Mon, 2 Jun 2008 18:02:45 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: Completion/correction and _path_files Message-ID: <20080602180245.09137972@news01> In-Reply-To: <20080602174030.07a94732@news01> References: <080521073412.ZM11504@torch.brasslantern.com> <20080602174030.07a94732@news01> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Jun 2008 17:02:45.0324 (UTC) FILETIME=[7A3FD8C0:01C8C4D2] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.71.0.130 X-Virus-Scanned: ClamAV 0.91.2/7325/Mon Jun 2 15:45:22 2008 on bifrost X-Virus-Status: Clean On Mon, 2 Jun 2008 17:40:30 +0100 Peter Stephenson wrote: > However, there's a good chance this has got some side effect. One was quite easy to find. -U apparently overrides the use of the ignored prefix and suffix, too (the bits of the current word you've already considered and don't need as part of matching). I found this by trying to complete "scan +" which should skip over the "+" and complete subdirectories of my mail directory; the "+" disappeared. That much can be fixed by adding the ignored parts explicitly back in. This is a replacement version. Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.28 diff -u -r1.28 _path_files --- Completion/Unix/Type/_path_files 18 May 2008 20:51:48 -0000 1.28 +++ Completion/Unix/Type/_path_files 2 Jun 2008 16:57:57 -0000 @@ -595,7 +595,8 @@ # back up the path. tmp1=("${(@)tmp1%%/*}") _list_files tmp1 "$prepath$realpath$testpath" - compadd -Qf "$mopts[@]" -p "$linepath$tmp2" -s "/${tmp3#*/}" \ + compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" + -s "/${tmp3#*/}$ISUFFIX" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" \ $listopts \ @@ -604,16 +605,18 @@ # Same with a non-empty suffix tmp1=("${(@)^tmp1%%/*}/${tmp3#*/}") _list_files tmp1 "$prepath$realpath$testpath" - compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \ - -W "$prepath$realpath$testpath" \ + compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ + -s "$ISUFFIX" \ + -W "$prepath$realpath$testpath$ISUFFIX" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" \ $listopts \ -a tmp1 fi else _list_files tmp1 "$prepath$realpath$testpath" - compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \ - -W "$prepath$realpath$testpath" \ + compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ + -s "$ISUFFIX" + -W "$prepath$realpath$testpath$ISUFFIX" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" \ $listopts \ -a tmp1 @@ -621,7 +624,8 @@ else # We are inserting the match into the command line. if [[ "$tmp3" = */* ]]; then - tmp4=( -Qf "$mopts[@]" -p "$linepath$tmp2" + tmp4=( -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" + -s "$ISUFFIX" -W "$prepath$realpath$testpath" "$pfxsfx[@]" -M "r:|/=* r:|=*" ) if [[ -z "$listsfx" ]]; then @@ -640,7 +644,8 @@ fi else _list_files tmp1 "$prepath$realpath$testpath" - compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \ + compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ + -s "$ISUFFIX" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" \ $listopts \ @@ -708,7 +713,8 @@ compquote tmp4 tmp2 tmp1 for i in "$tmp1[@]"; do _list_files tmp2 "$prepath$realpath${mid%/*/}" - compadd -Qf "$mopts[@]" -p "$linepath$tmp3/" -s "/$tmp4$i" \ + compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp3/" \ + -s "/$tmp4$i$ISUFFIX" \ -W "$prepath$realpath${mid%/*/}/" \ "$pfxsfx[@]" -M "r:|/=* r:|=*" $listopts - "$tmp2" done @@ -738,7 +744,9 @@ else # Not a pattern match _list_files tmp1 "$prepath$realpath$testpath" - compadd -Qf -p "$linepath$tmp4" -W "$prepath$realpath$testpath" \ + compadd -U -Qf -p "$IPREFIX$linepath$tmp4" \ + -s "$ISUFFIX" \ + -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" "$mopts[@]" -M "r:|/=* r:|=*" $listopts -a tmp1 fi fi