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

PATCH: bug scrolling multiline completion displays



Peter Stephenson wrote:
> On a completely separate completion matter, only I'm lazy, there's still
> a subtle bug in zsh/complist when scrolling is active (i.e. not all
> completions fit on the screen) with lines that wrap (i.e. are larger
> than the column width).  It's OK when scrolling forwards (i.e. down,
> since across won't be possible in this case), but if you attempt to
> scroll back up from the line after the wrapping line, instead of showing
> you the wrapping line it repeats the line you were just on.  Then you're
> stuck at that point; you can't go up further.

Found it... and this time I more or less understood what it was doing.
I feel a little bit funny.

Actually, it's fairly obvious... printfmt() in zle_tricky.c() is even
documented(!) to return a number of lines, so dividing the return value
by the screen width is not the right thing to do.  Still took me two
days to find, though.

I have no idea why this didn't show up before; it appears the code has
always been like this.  Before I edited the line to try to get columns
right, it was last edited by Sven in 2000.

I'll add some commentary to complist.c if I can convince myself I've
worked out enough of what's going on.

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.92
diff -u -r1.92 complist.c
--- Src/Zle/complist.c	14 Aug 2006 13:29:30 -0000	1.92
+++ Src/Zle/complist.c	15 Aug 2006 20:57:26 -0000
@@ -1529,11 +1529,7 @@
             }
 	}
 	if (!dolist(ml)) {
-	    int nc = printfmt(m->disp, 0, 0, 0);
-	    if (nc)
-		mlprinted = (nc - 1) / columns;
-	    else
-		mlprinted = 0;
+	    mlprinted = printfmt(m->disp, 0, 0, 0);
 	    return 0;
 	}
 	if (m->gnum == mselect) {

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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