diff options
| author | Peter Stephenson <pws@zsh.org> | 2014-12-08 09:46:30 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@zsh.org> | 2014-12-08 09:46:30 +0000 |
| commit | a4799145da74a89ae056bc8355fcc8319cce8a9c (patch) | |
| tree | b3a7cefd9d0d268d3dcfa58a3937b60b34bf0062 /Completion | |
| parent | 33912: fix filename default case (diff) | |
| download | zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar.gz zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar.bz2 zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar.lz zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar.xz zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.tar.zst zsh-a4799145da74a89ae056bc8355fcc8319cce8a9c.zip | |
33843: minor optimisation for recursive-files.
Expand the recursive path only the first time we need it.
Diffstat (limited to 'Completion')
| -rw-r--r-- | Completion/Unix/Type/_files | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index 0f6fcd6ff..e628cb39e 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -121,9 +121,13 @@ for def in "$pats[@]"; do if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then ret=0 elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles; then + local subtree for rfile in $rfiles; do if [[ $PWD/ = ${~rfile} ]]; then - for prepath in **/*(/); do + if [[ -z $subtree ]]; then + subtree=( **/*(/) ) + fi + for prepath in $subtree; do oprefix=$PREFIX PREFIX=$prepath/$PREFIX _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0 |
