about summary refs log tree commit diff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 8e713348f..44ec8ef6a 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1538,6 +1538,8 @@ addmatches(Cadata dat, char **argv)
 		endcmgroup(NULL);
 		begcmgroup("default", 0);
 	    }
+	    if (dat->mesg)
+		addmesg(dat->mesg);
 	} SWITCHBACKHEAPS;
 
 	return 1;
@@ -1785,6 +1787,8 @@ addmatches(Cadata dat, char **argv)
 	    endcmgroup(NULL);
 	    begcmgroup("default", 0);
 	}
+	if (dat->mesg)
+	    addmesg(dat->mesg);
 	if (*argv) {
 	    if (dat->pre)
 		dat->pre = dupstring(dat->pre);
@@ -2366,6 +2370,28 @@ addexpl(void)
     newmatches = 1;
 }
 
+/* Add a message to the current group. Make sure it is shown. */
+
+/**/
+mod_export void
+addmesg(char *mesg)
+{
+    LinkNode n;
+    Cexpl e;
+
+    for (n = firstnode(expls); n; incnode(n)) {
+	e = (Cexpl) getdata(n);
+	if (!strcmp(mesg, e->str))
+	    return;
+    }
+    e = (Cexpl) zhalloc(sizeof(*e));
+    e->count = e->fcount = 1;
+    e->str = dupstring(mesg);
+    addlinknode(expls, e);
+    newmatches = 1;
+    mgroup->new = 1;
+}
+
 /* The comparison function for matches (used for sorting). */
 
 /**/