Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: all completions
- X-seq: zsh-workers 12938
 
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx
 
- Subject: RE: all completions
 
- Date: Tue, 10 Oct 2000 10:11:41 +0200 (MET DST)
 
- In-reply-to: "Andrej Borsenkow"'s message of Tue, 10 Oct 2000 12:03:54 +0400
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
Andrej Borsenkow wrote:
> > The patch also contains a completer, _all_matches,
> 
> Pardon me, it does not :-) This is the problem with newly added files - you
> have first to 'cvs add' them; then you can generate patch with 'cvs diff -N'.
> Else 'cvs diff -N' ingnores newly born files.
Since this is a test-patch which isn't committed, this hasn't anything 
to do with cvs. It's a matter of my little brain forgatting to create
an empty file in the directory I'm diffing against. Sigh.
Bye
 Sven
--- ../oz/Completion/Core/_all_matches	Tue Oct 10 10:07:05 2000
+++ Completion/Core/_all_matches	Mon Oct  9 21:15:04 2000
@@ -0,0 +1,35 @@
+#autoload
+
+_all_matches() {
+  local old
+
+  zstyle -s ":completion:${curcontext}:" old-matches old
+
+  if [[ "$old" = (only|true|yes|1|on) ]]; then
+
+    if [[ -n "$compstate[old_list]" ]]; then
+      compstate[insert]=all
+      compstate[old_list]=keep
+      return 0
+    fi
+
+    [[ "$old" = *only* ]] && return 1
+  fi
+
+  (( $comppostfuncs[(I)_all_matches_end] )) ||
+      comppostfuncs=( "$comppostfuncs[@]" _all_matches_end )
+
+  return 1
+}
+
+_all_matches_end() {
+  if [[ "$compstate[nmatches]" -gt 1 ]]; then
+    local disp expl
+
+    _description all-matches expl 'all matches'
+    disp=('all matches...')
+    compadd "$expl[@]" -C -d disp
+  fi
+}
+
+_all_matches "$@"
--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author