about summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-12 12:35:38 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-12 12:35:38 +0000
commit4a3b94ca4011b81ef704fdd600bb11cdc00a2a94 (patch)
tree65fd7b1aceb7880fef13ee5d0ecd659529e1809e /Completion/Core
parent4a250fe1dd8de01746b5ffc4612d01adc619b2cd (diff)
downloadzsh-4a3b94ca4011b81ef704fdd600bb11cdc00a2a94.tar.gz
zsh-4a3b94ca4011b81ef704fdd600bb11cdc00a2a94.tar.xz
zsh-4a3b94ca4011b81ef704fdd600bb11cdc00a2a94.zip
allow brace expansion on patterns for file-patterns and tag-order (10695)
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_files15
-rw-r--r--Completion/Core/_tags3
2 files changed, 11 insertions, 7 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files
index fad833d76..777d09f44 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -6,7 +6,11 @@ zparseopts -a opts \
     '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
 
 type="${(@j::M)${(@)tmp#-}#?}"
-(( $tmp[(I)-g*] )) && glob="${(j:,:)${(@M)tmp:#-g*}#-g}"
+if (( $tmp[(I)-g*] )); then
+  glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
+  [[ "$glob" = *[^\\][[:blank:]]* ]] &&
+      glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}"
+fi
 ign=$opts[(I)-F]
 if (( ign )); then
   ign=( $=opts[ign+1] )
@@ -22,7 +26,7 @@ fi
 if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then
   [[ "$type" = */* ]] && glob="$glob,*(-/)"
   pats=()
-  for i in ${tmp//\\%p/ ${${glob:-\*}//:/\\:} }; do
+  for i in ${tmp//\\%p/${${glob:-\*}//:/\\:} }; do
     if [[ $i = *[^\\]:* ]]; then
       pats=( "$pats[@]" " $i " )
     else
@@ -45,9 +49,9 @@ else
 fi
 
 for def in "$pats[@]"; do
-  def="${def##[[:blank:]]#}"
-  while [[ "$def" = *[^\\][[:blank:]]* ]]; do
-    sdef="${${(M)def#*[^\\][[:blank:]]}%%[[:blank:]]#}"
+  eval "def=( ${${def:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
+  for sdef in "$def[@]"; do
+
     tag="${${sdef#*[^\\]:}%%:*}"
     pat="${${${sdef%%:${tag}*}//\\\\:/:}//,/ }"
 
@@ -70,7 +74,6 @@ for def in "$pats[@]"; do
         fi
       done
     done
-    def="${${def#${sdef}}##[[:blank:]]#}"
   done
   (( ret )) || return 0
 done
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index 496f5b7e0..205fdb367 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -64,7 +64,8 @@ if (( $# )); then
              fi
              ;;
       \!*)   comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";;
-      ?*)    comptry -m "$tag";;
+      ?*)    eval "tag=( ${${tag:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )" 
+             comptry -m "${${(@)tag// /\\ }}";;
       esac
     done