1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-02 06:40:55 +01:00

users/12858: add accept-exact-dirs style

This commit is contained in:
Peter Stephenson 2008-05-18 20:51:47 +00:00
parent 93fa3796c2
commit 7eed3e6d5d
2 changed files with 26 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2008-05-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
* users/12858: Doc/Zsh/compsys.yo,
Completion/Unix/Type/_path_files: add accept-exact-dirs style.
* unposted: Completion/compinit: fix unwanted output from
typeset.

View file

@ -318,6 +318,29 @@ for prepath in "$prepaths[@]"; do
skipped=
cpre=
if zstyle -t ":completion:${curcontext}:paths" accept-exact-dirs &&
[[ $pre = (#b)(*)/([^/]#) ]]; then
# We've been told that we can accept an exact directory
# prefix immediately. Try this with the longest path prefix
# first: this saves stats in the simple case and may get around
# automount behaviour if early components don't yet exist.
tmp1=$match[1]
tpre=$match[2]
while true; do
if [[ -d $donepath$tmp1 ]]; then
donepath=$donepath$tmp1/
pre=$tpre
break
elif [[ $tmp1 = (#b)(*)/([^/]#) ]]; then
tmp1=$match[1]
tpre=$match[2]/$tpre
else
break
fi
done
fi
tpre="$pre"
tsuf="$suf"
testpath="$donepath"