Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: _path_files and glob qualifiers



Bart Schaefer wrote:

> On May 29, 11:54am, Sven Wischnowsky wrote:
> } Subject: Re: _path_files and glob qualifiers
> }
> } Maybe when doing matching, we should copy all qualifiers from the line 
> } to the patterns used when generating matches (and remove the
> } qualifiers for matching purposes).
> 
> That would probably work.

At least for this case, it looks good...

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.15
diff -u -r1.15 _path_files
--- Completion/Core/_path_files	2000/05/25 12:01:38	1.15
+++ Completion/Core/_path_files	2000/05/29 13:08:15
@@ -147,6 +147,29 @@
 
 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.
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author