summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2005-10-04 14:27:12 +0000
committerBart Schaefer <barts@users.sourceforge.net>2005-10-04 14:27:12 +0000
commit7f3c92059f89ea796ff403b45458621d2d5a7213 (patch)
treed495ec7194dc5d1cec1f8d7c33c13edc5305ef77
parentc1b01cfba2723b720f4c96f3628b575986080a1a (diff)
downloadzsh-7f3c92059f89ea796ff403b45458621d2d5a7213.tar.gz
zsh-7f3c92059f89ea796ff403b45458621d2d5a7213.tar.xz
zsh-7f3c92059f89ea796ff403b45458621d2d5a7213.zip
21821, 21822: fix two infinite loops
-rw-r--r--ChangeLog9
-rw-r--r--Src/Zle/complist.c10
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 82c53e098..d8482d70a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-10-04  Bart Schaefer  <schaefer@zsh.org>
+
+	* 21822 (annotated): Src/Zle/complist.c: prevent a long-standing
+	infinite loop when redrawing the listing during menu-selection
+	with a very narrow window.
+
+	* 21821: Src/Zle/complist.c: fix infinite loop when multibyte
+	support is disabled, introduced by 21784.
+
 2005-10-03  Peter Stephenson  <pws@csr.com>
 
 	* 21809: Src/utils.c: need to export nicedup() for
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index a9d57ae43..b13932e24 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -672,7 +672,7 @@ clnicezputs(Listcols colors, char *s, int ml)
     if (colors)
 	initiscol(colors);
 
-    while ((cc = *s)) {
+    while ((cc = *s++)) {
 	if (colors)
 	    doiscol(colors, i++);
 	if (itok(cc)) {
@@ -2153,9 +2153,15 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    if (y < mlines)
 		mline = y;
 	}
+	DPUTS(mline < 0,
+	      "BUG: mline < 0 after re-scanning mtab in domenuselect()");
 	while (mline < mlbeg)
-	    if ((mlbeg -= step) < 0)
+	    if ((mlbeg -= step) < 0) {
 		mlbeg = 0;
+		/* Crude workaround for BUG above */
+		if (mline < 0)
+		    break;
+	    }
 
 	if (mlbeg && lbeg != mlbeg) {
 	    Cmatch **p = mtab + ((mlbeg - 1) * columns), **q;