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

PATCH? - Re: Bug? in complist when filenames are longer than the screen



On Oct 4,  2:07am, Bart Schaefer wrote:
}
} I don't really know what the problem is

I still don't know what the problem is, but I have a reproducible
infinite loop.  Use a PS1 string at least 10 characters long, and
make the window narrower than 12 characters, so that the first
completion filled in on the command line by menu-completion is
forced to wrap to the next line of the screen.  Then begin doing
menu completion with listing.  When the completion reaches the end
of the list and wraps back to the first entry, zsh goes into an
infinite loop attempting to compute the *line* on which to begin
redrawing.

The following prevents the infinite loop, but is almost certainly
not the best patch.  However, I don't understand this code well
enough to produce a better one.

It should be possible to apply this patch after my "defensive" one,
though all those defenses against looping on the column count were
of no help when the actual loop was on the line count.

--- current/Src/Zle/complist.c	Mon Oct  3 21:15:31 2005
+++ Src/Zle/complist.c	Mon Oct  3 21:25:34 2005
@@ -2154,8 +2154,11 @@
 		mline = y;
 	}
 	while (mline < mlbeg)
-	    if ((mlbeg -= step) < 0)
+	    if ((mlbeg -= step) < 0) {
 		mlbeg = 0;
+		if (mline < 0)
+		    break;
+	    }
 
 	if (mlbeg && lbeg != mlbeg) {
 	    Cmatch **p = mtab + ((mlbeg - 1) * columns), **q;



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