about summary refs log tree commit diff
path: root/Src/Zle/compresult.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r--Src/Zle/compresult.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 8b5955819..cd8c7dd64 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -612,9 +612,10 @@ instmatch(Cmatch m, int *scs)
 	int pcs = zlemetacs;
 
 	l = 0;
-	for (bp = brbeg, brpos = m->brpl,
-		 bradd = (m->pre ? strlen(m->pre) : 0);
-	     bp; bp = bp->next, brpos++) {
+	bradd = (m->pre ? strlen(m->pre) : 0);
+	for (bp = brbeg, brpos = m->brpl;
+	     bp && brpos;
+	     bp = bp->next, brpos++) {
 	    zlemetacs = a + *brpos + bradd;
 	    pcs = zlemetacs;
 	    l = strlen(bp->str);
@@ -896,7 +897,7 @@ void
 do_allmatches(UNUSED(int end))
 {
     int first = 1, nm = nmatches - 1, omc = menucmp, oma = menuacc, e;
-    Cmatch *mc;
+    Cmatch *mc = 0;
     struct menuinfo mi;
     char *p = (brbeg ? ztrdup(lastbrbeg->str) : NULL);
 
@@ -914,10 +915,10 @@ do_allmatches(UNUSED(int end))
 #endif
     }
 
+    if (minfo.group)
+	mc = (minfo.group)->matches;
 
-    mc = (minfo.group)->matches;
-
-    while (1) {
+    while (mc) {
 	if (!((*mc)->flags & CMF_ALL)) {
 	    if (!first)
 		accept_last();
@@ -1730,8 +1731,6 @@ calclist(int showall)
                                  width < zterm_columns && nth < g->dcount;
                                  nth++, tcol++) {
 
-                                m = *p;
-
                                 if (tcol == tcols) {
                                     tcol = 0;
                                     tlines++;
@@ -1993,7 +1992,6 @@ printlist(int over, CLPrintFunc printm, int showall)
 		     (listdat.onlyexpl & ((*e)->always > 0 ? 2 : 1)))) {
 		    if (pnl) {
 			putc('\n', shout);
-			pnl = 0;
 			ml++;
 			if (cl >= 0 && --cl <= 1) {
 			    cl = -1;
@@ -2086,7 +2084,6 @@ printlist(int over, CLPrintFunc printm, int showall)
                         (showall || !(m->flags & (CMF_HIDE|CMF_NOLIST)))) {
 			if (pnl) {
 			    putc('\n', shout);
-			    pnl = 0;
 			    ml++;
 			    if (cl >= 0 && --cl <= 1) {
 				cl = -1;
@@ -2247,15 +2244,13 @@ iprintm(Cmgroup g, Cmatch *mp, UNUSED(int mc), UNUSED(int ml), int lastc, int wi
 #ifdef MULTIBYTE_SUPPORT
 	len = mb_niceformat(m->disp, shout, NULL, 0);
 #else
-	nicezputs(m->disp, shout);
-	len = niceztrlen(m->disp);
+	len = sb_niceformat(m->disp, shout, NULL, 0);
 #endif
     } else {
 #ifdef MULTIBYTE_SUPPORT
 	len = mb_niceformat(m->str, shout, NULL, 0);
 #else
-	nicezputs(m->str, shout);
-	len = niceztrlen(m->str);
+	len = sb_niceformat(m->str, shout, NULL, 0);
 #endif
 
 	if ((g->flags & CGF_FILES) && m->modec) {