From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: 3.1.5-pws-10: _tar
Date: Fri, 5 Mar 1999 09:18:58 +0100 (MET) [thread overview]
Message-ID: <199903050818.JAA03410@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Thu, 04 Mar 1999 17:29:08 +0100
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-<TAB> 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
next reply other threads:[~1999-03-05 8:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-05 8:18 Sven Wischnowsky [this message]
1999-03-05 8:52 ` Peter Stephenson
-- strict thread matches above, loose matches on Subject: below --
1999-03-04 15:52 Sven Wischnowsky
1999-03-04 16:29 ` Peter Stephenson
1999-03-02 10:35 Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199903050818.JAA03410@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).