From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16399 invoked from network); 5 Mar 1999 08:20:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Mar 1999 08:20:15 -0000 Received: (qmail 27667 invoked by alias); 5 Mar 1999 08:19:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5647 Received: (qmail 27660 invoked from network); 5 Mar 1999 08:19:41 -0000 Date: Fri, 5 Mar 1999 09:18:58 +0100 (MET) Message-Id: <199903050818.JAA03410@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Thu, 04 Mar 1999 17:29:08 +0100 Subject: Re: PATCH: 3.1.5-pws-10: _tar Peter Stephenson wrote: > Sven Wischnowsky wrote: > > The things below adds a helper function `_multi_parts' that gets two > > arguments: a separator character and an array (name or `(...)'). It > > will then complete the parts of the words that are separated by the > > separator character. > > > > It also changes the `_tar' function to use `_multi_parts', maybe Peter > > would like to put the changed one into `_tar2' so that users can > > decide which one they want. > > This isn't working for directories for me. After zsh-3.1.5-pws-10/ it will > complete files, but not Src. Typing Src/ makes it complete files but not > directories down there, and so on. Trying to do a lot in one go leaves a > space where Src should have been, and makes no change after that. > > In fact, now it's stopped working altogether: zsh- does nothing in > that position. It's calling _multi_parts, and the list of files is right, > but nothing's coming back. When I type zsh-3.1.5-pws-10/, I can see it > generate a list of completions with that removed, then I get this It was too eager to replace `*s' with `[^/]#'s. The patch below does the replacement only for the non-last components. Bye Sven diff -u oc/Core/_multi_parts Completion/Core/_multi_parts --- oc/Core/_multi_parts Thu Mar 4 16:53:13 1999 +++ Completion/Core/_multi_parts Fri Mar 5 09:18:56 1999 @@ -67,7 +67,8 @@ # `matches' that match the prefix we have and the exact substring in # the array `tmp1'. - eval "pat=\"\${\${patstr#*\${sep}}:gs${gsep}*${gsep}[^${sep}]#${gsep}}\"" + tmp1="${${patstr#*${sep}}%${sep}*}" + eval "pat=\"\${tmp1:gs${gsep}*${gsep}[^${sep}]#${gsep}}${patstr##*${sep}}\"" tmp1=( "${(@M)matches:#${~matchflags}${orig%%${sep}*}${sep}${~pat}}" ) # If there are no words matching the exact substring, stop. @@ -86,7 +87,12 @@ # Now we get all the words that still match in `tmp1'. -eval "pat=\"\$patstr:gs${gsep}*${gsep}[^${sep}]#${gsep}\"" +if [[ "$patstr" = *${sep}* ]]; then + tmp1="${patstr%${sep}*}${sep}" + eval "pat=\"\$tmp1:gs${gsep}*${gsep}[^${sep}]#${gsep}${patstr##*${sep}}\"" +else + pat="$patstr" +fi tmp1=( "${(@M)matches:#${~matchflags}${~pat}}" ) if (( $#tmp1 )); then @@ -123,7 +129,7 @@ fi done -elif [[ "$patstr" = */* ]]; then +elif [[ "$patstr" = *${sep}* ]]; then # We had no words matching the string from the line. But we want to # be friendly and at least expand the prefix as far as we can. So we -- Sven Wischnowsky wischnow@informatik.hu-berlin.de