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

PATCH: turn off baud rate compensation by default

I was seeing odd delays in my xterm when updating long lines (but not
*that* long: about ten screen lines) which I eventually tracked down to
the baud rate compensation mechanism in zle.  Setting BAUD to 0 removed
this effect, but it seems to me that it's no longer appropriate to turn
this on by default:

- If it took me several minutes to find out where the delay was coming
from, it's going to puzzle a lot of people if they notice it.  That
would be OK if the benefits outweighed this.  However:
- It's initialised from the output baud rate set in the terminal driver.
On most modern systems that's got very little to do with the actual
rate at which the display is updated; it's a hangover from the days of
serial communications when your terminal was attached by RS232 rather
than a virtual terminal running in an ATI RADEON SeveralZillion (TM)
1024 squigabyte display card.
- If you *do* have a slow line, nowadays it's probably the Internet,
or some modem line between your PC and the shell server, not the
actual terminal line for which the baud rate is available to the shell.
- Hence on those occasions where it makes a useful difference, it's
almost always better to allow the user to set BAUD to an appropriate

I won't check this in until you've had a chance to fault my logic.

Index: Doc/Zsh/params.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.35
diff -u -r1.35 params.yo
--- Doc/Zsh/params.yo	30 Oct 2006 10:37:17 -0000	1.35
+++ Doc/Zsh/params.yo	7 Feb 2007 11:30:48 -0000
@@ -744,17 +744,15 @@
-The baud rate of the current connection.  Used by the line editor
-update mechanism to compensate for a slow terminal by delaying
-updates until necessary.  This may be profitably set to a lower value
-in some circumstances, e.g.
-for slow modems dialing into a communications server which is connected
-to a host via a fast link; in this case, this variable
-would be set by default to the speed of the fast link, and not
-the modem.
-This parameter should be set to the baud
-rate of the slowest part of the link for best performance. The compensation
-mechanism can be turned off by setting the variable to zero.
+The rate in bits per second at which data reaches the terminal.
+The line editor will use this value in order to compensate for a slow
+terminal by delaying updates to the display until necessary.  The default
+value is zero, which turns off the compensation mechanism.
+This may be profitably set in some circumstances, e.g.
+for slow modems dialing into a communications server, or on a slow wide
+area network.  This parameter should be set to the baud
+rate of the slowest part of the link for best performance.
Index: Src/params.c
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.122
diff -u -r1.122 params.c
--- Src/params.c	6 Feb 2007 21:47:55 -0000	1.122
+++ Src/params.c	7 Feb 2007 11:30:51 -0000
@@ -641,7 +641,17 @@
     setiparam("KEYTIMEOUT", 40);
     setiparam("LISTMAX", 100);
-    setiparam("BAUD", getbaudrate(&shttyinfo));  /* get the output baudrate */
+    /*
+     * We used to get the output baud rate here.  However, that's
+     * pretty irrelevant to a terminal on an X display and can lead
+     * to unnecessary delays if it's wrong (which it probably is).
+     * Furthermore, even if the output is slow it's very likely
+     * to be because of WAN delays, not covered by the output
+     * baud rate.
+     * So allow the user to set it in the special cases where it's
+     * useful.
+     */
+    setiparam("BAUD", 0);
     setsparam("TMPPREFIX", ztrdup(DEFAULT_TMPPREFIX));
     setsparam("TIMEFMT", ztrdup(DEFAULT_TIMEFMT));

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

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

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