zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: make compadd create empty groups
@ 1999-12-01  9:48 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-12-01  9:48 UTC (permalink / raw)
  To: zsh-workers


This ensures that compadd without matches but with a -[JV] at least
creates the group (and otherwise does nothing else). This allows us to 
easily ensure a certain ordering of groups by just creating them with
`compadd -J foo' at the beginning. In a patch to follow.

Bye
 Sven

diff -u oldsrc/Zle/compcore.c Src/Zle/compcore.c
--- oldsrc/Zle/compcore.c	Mon Nov 29 10:10:36 1999
+++ Src/Zle/compcore.c	Wed Dec  1 10:19:24 1999
@@ -1686,6 +1686,17 @@
 		    }
 		}
 	    }
+	    /* Select the group in which to store the matches. */
+	    gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
+		      ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
+		      ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
+	    if (dat->group) {
+		endcmgroup(NULL);
+		begcmgroup(dat->group, gflags);
+	    } else {
+		endcmgroup(NULL);
+		begcmgroup("default", 0);
+	    }
 	    if (*argv) {
 		if (dat->pre)
 		    dat->pre = dupstring(dat->pre);
@@ -1696,17 +1707,6 @@
 		    untokenize(dat->prpre);
 		} else
 		    dat->prpre = dupstring(dat->prpre);
-		/* Select the group in which to store the matches. */
-		gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
-			  ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
-			  ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
-		if (dat->group) {
-		    endcmgroup(NULL);
-		    begcmgroup(dat->group, gflags);
-		} else {
-		    endcmgroup(NULL);
-		    begcmgroup("default", 0);
-		}
 		/* Select the set of matches. */
 		oisalt = (dat->aflags & CAF_ALT);
 
diff -u oldsrc/Zle/complete.c Src/Zle/complete.c
--- oldsrc/Zle/complete.c	Mon Nov 29 10:10:36 1999
+++ Src/Zle/complete.c	Wed Dec  1 10:41:14 1999
@@ -599,7 +599,9 @@
 	}
     }
  ca_args:
-    if (!*argv)
+
+    if (!*argv && !dat.group &&
+	!(dat.aflags & (CAF_NOSORT|CAF_UNIQALL|CAF_UNIQCON)))
 	return 1;
 
     dat.match = match = cpcmatcher(match);

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

only message in thread, other threads:[~1999-12-01  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-01  9:48 PATCH: make compadd create empty groups 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).