summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_files6
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