From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: Completion/correction and _path_files
Date: Mon, 2 Jun 2008 18:02:45 +0100 [thread overview]
Message-ID: <20080602180245.09137972@news01> (raw)
In-Reply-To: <20080602174030.07a94732@news01>
On Mon, 2 Jun 2008 17:40:30 +0100
Peter Stephenson <pws@csr.com> 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
next prev parent reply other threads:[~2008-06-02 17:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-21 14:34 Bart Schaefer
2008-06-02 16:40 ` Peter Stephenson
2008-06-02 17:02 ` Peter Stephenson [this message]
2008-06-02 17:07 ` Peter Stephenson
2008-06-04 9:29 ` 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=20080602180245.09137972@news01 \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.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).