about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-07-14 12:48:37 +0200
committerOliver Kiddle <opk@zsh.org>2015-07-14 12:48:37 +0200
commitb230e6d11d78271f3fc2492b51ddf8f7c109b500 (patch)
tree9ec600406cb1d940712f5d6cf53394349a10eb3b /Completion
parent40a6f1d34784ba6d0ce5179e415ea0f2a362bb32 (diff)
downloadzsh-b230e6d11d78271f3fc2492b51ddf8f7c109b500.tar.gz
zsh-b230e6d11d78271f3fc2492b51ddf8f7c109b500.tar.xz
zsh-b230e6d11d78271f3fc2492b51ddf8f7c109b500.zip
35789: (tweaked c.f. Bart: 35791): duplicate glob qualifier handling from _path_files so it is called once and not for each file pattern
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_files20
1 files changed, 19 insertions, 1 deletions
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index e628cb39e..a8ba9b3ce 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -1,6 +1,24 @@
 #compdef -redirect-,-default-,-default-
 
-local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried
+local -a match mbegin mend
+local ret=1
+
+# Look for glob qualifiers. This is duplicated from _path_files because
+# we don't want to complete them multiple times (for each file pattern).
+if _have_glob_qual $PREFIX; then
+  compset -p ${#match[1]}
+  if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
+    _globflags && ret=0
+  else
+    if [[ $_comp_caller_options[extendedglob] == on ]]; then
+      _describe -t globflags "glob flag" '(\#:introduce\ glob\ flag)' -Q -S '' && ret=0
+    fi
+    _globquals && ret=0
+  fi
+  return ret
+fi
+
+local opts tmp glob pat pats expl tag i def descr end ign tried
 local type sdef ignvars ignvar prepath oprefix rfiles rfile
 
 zparseopts -a opts \