summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 13:11:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 13:11:59 +0000
commitacd0558e545591d9ee423a995ad4ff365736d185 (patch)
tree017056aec6e893914b0eb28be61d833ea6ae5023 /Completion
parentfb9ec18e9a78c1100fa4cad540498a848d404114 (diff)
downloadzsh-acd0558e545591d9ee423a995ad4ff365736d185.tar.gz
zsh-acd0558e545591d9ee423a995ad4ff365736d185.tar.xz
zsh-acd0558e545591d9ee423a995ad4ff365736d185.zip
make _path_files use glob qualifiers from the line when doing pattern matching (11635)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_path_files23
1 files changed, 23 insertions, 0 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index bfe370eed..a8567ab78 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -147,6 +147,29 @@ zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs &&
 
 zstyle -s ":completion:${curcontext}:files" ignore-parents ignpar
 
+if [[ -n "$compstate[pattern_match]" &&
+      ( ( -z "$SUFFIX" && "$PREFIX" = *\([^\|\~]##\) ) ||
+        "$SUFFIX" =  *\([^\|\~]##\) ) ]]; then
+  if [[ "$SUFFIX" = *\([^\|\~]##\) ]]; then
+    tmp3="${${(M)SUFFIX%\([^\|\~]##\)}[2,-2]}"
+    SUFFIX="${SUFFIX%\($tmp3\)}"
+  else
+    tmp3="${${(M)PREFIX%\([^\|\~]##\)}[2,-2]}"
+    PREFIX="${PREFIX%\($tmp3\)}"
+  fi
+  tmp2=()
+  for tmp1 in "$pats[@]"; do
+    if [[ "$tmp1" = (#b)(?*)(\(\([^\|~]##\)\)) ]]; then
+      tmp2=( "$tmp2[@]" "${match[1]}((${tmp3}${match[2][3,-1]}" )
+    elif [[ "$tmp1" = (#b)(?*)(\([^\|~]##\)) ]]; then
+      tmp2=( "$tmp2[@]" "${match[1]}(${tmp3}${match[2][2,-1]}" )
+    else
+      tmp2=( "$tmp2[@]" "${tmp1}(${tmp3})" )
+    fi
+  done
+  pats=( "$tmp2[@]" )
+fi
+
 # We get the prefix and the suffix from the line and save the whole
 # original string. Then we see if we will do menucompletion.