diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-05-18 20:51:47 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-05-18 20:51:47 +0000 |
commit | 7eed3e6d5dd9d1c07be0f6069728e21381718599 (patch) | |
tree | 907d16824951746380ed7e8ce5a1aec8055ad07a | |
parent | 93fa3796c230d6344547729bdcecc72e90bf1b6d (diff) | |
download | zsh-7eed3e6d5dd9d1c07be0f6069728e21381718599.tar.gz zsh-7eed3e6d5dd9d1c07be0f6069728e21381718599.tar.xz zsh-7eed3e6d5dd9d1c07be0f6069728e21381718599.zip |
users/12858: add accept-exact-dirs style
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Completion/Unix/Type/_path_files | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index cb321790e..9bb282d3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index e75e81efd..fc0789f01 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -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" |