From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13853 invoked by alias); 3 Jun 2011 08:34:13 -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: 29444 Received: (qmail 802 invoked from network); 3 Jun 2011 08:34:11 -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: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110603013407.ZM16592@torch.brasslantern.com> Date: Fri, 03 Jun 2011 01:34:07 -0700 In-reply-to: <110602071346.ZM15593@torch.brasslantern.com> Comments: In reply to Bart Schaefer "PATCH (?) Re: strange completion" (Jun 2, 7:13am) References: <4DE6ABF6.10405@sergio.spb.ru> <110601194609.ZM14369@torch.brasslantern.com> <4DE765F2.5000704@sergio.spb.ru> <110602071346.ZM15593@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: PATCH (?) Re: strange completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 2, 7:13am, Bart Schaefer wrote: } } I'm not sure whether the following is the correct fix, or whether that } entire if/elif/else cascade should be wrapped in } } if [[ -n "$fake" ]]; then That last idea is definitely wrong, at the least the "else" branch needs to be taken, but this -- } + if [[ "$tpre$tsuf" = */* && -n "$fake" ]]; then -- is also too much. It's OK for $fake to be empty as long as there is something after the final slash in "$tpre$tsuf". I was mildly surprised to discover that in [[ ... && ... ]] the stuff to the left of the && is evaluated before expanding variables in the stuff to the right of the &&. The question for the patch below is, in [[ foo/bar/ = (#b)*/(*) ]] is $match[1] guaranteed to be empty? Or do I need ([^/]#) to be safe? And jeez, somebody really needs to document compfiles *somewhere*. I recall we didn't want it detailed in the man page doc for some reason, but ... Index: Completion/Unix/Type/_path_files =================================================================== --- Completion/Unix/Type/_path_files 1 Jun 2011 06:39:59 -0000 +++ Completion/Unix/Type/_path_files 3 Jun 2011 08:12:48 -0000 @@ -438,7 +438,7 @@ tmp2=( "$tmp1[@]" ) - if [[ "$tpre$tsuf" = */* ]]; then + if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake elif [[ "$sopt" = *[/f]* ]]; then compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]"