1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-26 04:30:27 +01:00

33843: minor optimisation for recursive-files.

Expand the recursive path only the first time we need it.
This commit is contained in:
Peter Stephenson 2014-12-08 09:46:30 +00:00
parent 09959eb9d6
commit a4799145da
2 changed files with 10 additions and 1 deletions

View file

@ -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