Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: complist with long display lines
- X-seq: zsh-workers 22597
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: PATCH: complist with long display lines
- Date: Thu, 10 Aug 2006 17:22:54 +0100
- In-reply-to: <20060809230445.6eb66ce0.p.w.stephenson@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200608071540.k77FeWcL020899@xxxxxxxxxxxxxx> <060807101946.ZM19622@xxxxxxxxxxxxxxxxxxxxxx> <20060809230445.6eb66ce0.p.w.stephenson@xxxxxxxxxxxx>
Peter Stephenson wrote:
> The same mistake seems to appear somewhere else, I think, and with some
> trepidation I've changed an occurrence in printfmt() in zle_tricky.c;
> you'll see that it does subtract the 1 further up in the bit where it's
> found a newline.
This appears to be wrong both here and the corresponding change in
complist.c, functions printfmt() and compprintfmt() respectively. This
turned up when I was using the file-list zstyle with a description which
(including the file name at the end) just happened to hit the right hand
edge of the screen. In this case, unlike the others, you get a new line at
the end of the display; I'm guessing this makes the difference. (However,
obviously it isn't the calculation I'm modifying that produces the extra
newline, so I don't know where that comes from.) The two changes affect
the non-complist and complist display of the same output.
This is different from the other cases because... er... oh look! There's
Superman! Over there!
Luckily, changing these doesn't undo the main point of the fix. Phew.
I've subjected this to the combinations of tests I know about and they all
seem to work.
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.88
diff -u -r1.88 complist.c
--- Src/Zle/complist.c 9 Aug 2006 22:08:38 -0000 1.88
+++ Src/Zle/complist.c 10 Aug 2006 16:15:47 -0000
@@ -1055,8 +1055,12 @@
if (stat && n)
mfirstl = -1;
- mlprinted = l + (cc ? ((cc-1) / columns) : 0);
- return mlprinted;
+ /*
+ * *Not* subtracting 1 from cc at this point appears to be
+ * correct. C.f. printfmt in zle_tricky.c.
+ */
+ mlprinted = l + (cc / columns);
+ return mlprinted;
}
/* This is like zputs(), but allows scrolling. */
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.71
diff -u -r1.71 zle_tricky.c
--- Src/Zle/zle_tricky.c 9 Aug 2006 22:08:39 -0000 1.71
+++ Src/Zle/zle_tricky.c 10 Aug 2006 16:15:49 -0000
@@ -2175,7 +2174,12 @@
putc(' ', shout);
}
}
- return l + ((cc-1) / columns);
+ /*
+ * Experiments suggest that at this point not subtracting 1 from
+ * cc is correct, i.e. if just misses wrapping we still add 1.
+ * (Why?)
+ */
+ return l + (cc / columns);
}
/* This is used to print expansions. */
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
Messages sorted by:
Reverse Date,
Date,
Thread,
Author