zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: _path_files and glob qualifiers
@ 2000-05-29 13:09 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 2000-05-29 13:09 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-05-29 13:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-29 13:09 PATCH: Re: _path_files and glob qualifiers Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).