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

PATCH: compadd and -J/-V



Since I was testing compadd anyway...

The group handling wasn't fully working yet, the list into which the
matches were stored was selected too early. And the group name wasn't
copied but could have been freed before used again.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Fri Feb 26 12:50:50 1999
+++ Src/Zle/zle_tricky.c	Fri Feb 26 16:05:50 1999
@@ -3916,14 +3916,6 @@
     struct cmlist mst;
     Cmlist oms = mstack;
 
-    /* Select the set of matches. */
-    if (aflags & CAF_ALT) {
-	l = fmatches;
-	ai = fainfo;
-    } else {
-	l = matches;
-	ai = ainfo;
-    }
     /* Use menu-completion (-U)? */
     if ((aflags & CAF_MENU) && isset(AUTOMENU))
 	usemenu = 1;
@@ -3989,6 +3988,17 @@
 		begcmgroup(group, (aflags & CAF_NOSORT));
 		if (aflags & CAF_NOSORT)
 		    mgroup->flags |= CGF_NOSORT;
+	    } else {
+		endcmgroup(NULL);
+		begcmgroup("default", 0);
+	    }
+	    /* Select the set of matches. */
+	    if (aflags & CAF_ALT) {
+		l = fmatches;
+		ai = fainfo;
+	    } else {
+		l = matches;
+		ai = ainfo;
 	    }
 	    if (remf) {
 		remf = dupstring(remf);
@@ -6782,7 +6796,7 @@
 	}
     }
     mgroup = (Cmgroup) halloc(sizeof(struct cmgroup));
-    mgroup->name = n;
+    mgroup->name = dupstring(n);
     mgroup->flags = mgroup->lcount = mgroup->mcount = 0;
     mgroup->matches = NULL;
     mgroup->ylist = NULL;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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