about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c11
-rw-r--r--Src/Zle/complist.c4
-rw-r--r--Src/Zle/compresult.c11
3 files changed, 17 insertions, 9 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 1a18f14e3..ded5c3b31 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -440,7 +440,7 @@ do_completion(Hookdef dummy, Compldat dat)
     if (!showinglist && validlist && usemenu != 2 && 
 	(nmatches != 1 || diffmatches) &&
 	useline >= 0 && useline != 2 && (!oldlist || !listshown)) {
-	onlyexpl = 1;
+	onlyexpl = 3;
 	showinglist = -2;
     }
  compend:
@@ -802,7 +802,8 @@ callcompfunc(char *s, char *fn)
 	else
 	    uselist = 0;
 	forcelist = (complist && strstr(complist, "force"));
-	onlyexpl = (complist && strstr(complist, "expl"));
+	onlyexpl = (complist ? ((strstr(complist, "expl") ? 1 : 0) |
+				(strstr(complist, "messages") ? 2 : 0)) : 0);
 
 	if (!compinsert)
 	    useline = 0;
@@ -2449,7 +2450,7 @@ addexpl(void)
 
     for (n = firstnode(expls); n; incnode(n)) {
 	e = (Cexpl) getdata(n);
-	if (!strcmp(curexpl->str, e->str)) {
+	if (e->count >= 0 && !strcmp(curexpl->str, e->str)) {
 	    e->count += curexpl->count;
 	    e->fcount += curexpl->fcount;
 
@@ -2471,11 +2472,11 @@ addmesg(char *mesg)
 
     for (n = firstnode(expls); n; incnode(n)) {
 	e = (Cexpl) getdata(n);
-	if (!strcmp(mesg, e->str))
+	if (e->count < 0 && !strcmp(mesg, e->str))
 	    return;
     }
     e = (Cexpl) zhalloc(sizeof(*e));
-    e->count = e->fcount = 1;
+    e->count = e->fcount = -1;
     e->str = dupstring(mesg);
     addlinknode(expls, e);
     newmatches = 1;
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index bbf2b8d4a..2f7873d63 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1026,7 +1026,9 @@ compprintlist(int showall)
 		lastused = 1;
 	    }
 	    while (*e) {
-		if ((*e)->count) {
+		if ((*e)->count &&
+		    (!listdat.onlyexpl ||
+		     (listdat.onlyexpl & ((*e)->count > 0 ? 1 : 2)))) {
 		    if (pnl) {
 			if (dolistnl(ml) && compprintnl(ml))
 			    goto end;
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 4ffd4d62a..1e807a93d 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1170,7 +1170,8 @@ comp_list(char *v)
     zsfree(complist);
     complist = ztrdup(v);
 
-    onlyexpl = (v && strstr(v, "expl"));
+    onlyexpl = (v ? ((strstr(v, "expl") ? 1 : 0) |
+		     (strstr(v, "messages") ? 2 : 0)) : 0);
 }
 
 /* This skips over matches that are not to be listed. */
@@ -1300,7 +1301,9 @@ calclist(int showall)
 	}
 	if ((e = g->expls)) {
 	    while (*e) {
-		if ((*e)->count)
+		if ((*e)->count &&
+		    (!onlyexpl ||
+		     (onlyexpl & ((*e)->count > 0 ? 1 : 2))))
 		    nlines += 1 + printfmt((*e)->str, (*e)->count, 0, 1);
 		e++;
 	    }
@@ -1690,7 +1693,9 @@ printlist(int over, CLPrintFunc printm, int showall)
 	    int l;
 
 	    while (*e) {
-		if ((*e)->count) {
+		if ((*e)->count &&
+		    (!listdat.onlyexpl ||
+		     (listdat.onlyexpl & ((*e)->count > 0 ? 1 : 2)))) {
 		    if (pnl) {
 			putc('\n', shout);
 			pnl = 0;