Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!utah-cs!utah-gr!thomas From: thomas@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: net.info-terms Subject: Re: Z29 Termcap Entry Message-ID: <883@utah-gr.UUCP> Date: Tue, 16-Aug-83 00:25:00 EDT Article-I.D.: utah-gr.883 Posted: Tue Aug 16 00:25:00 1983 Date-Received: Tue, 16-Aug-83 20:22:29 EDT References: mit-eddi.597 Lines: 130 What program would be silly enough to put the terminal into insert mode and shove stuff at it at 9600 baud you ask? Gosling's Emacs. Emacs seems to want to do the mathematically optimal thing in doing a redisplay rather than the practical thing. When it is about to output a line on top of a line that is already on the screen, instead of just killing to the end of the line and outputing the new line, it compares the old line and the new line and if there are any similarities, it constructs the new line by deleting the text on the old line on the terminal that is already there and then inserting new text into the line to transform it into the new line that is to be displayed. The Z29 does not act kindly to this. There is a fix to this problem. The termcap driver in Gosling's emacs does not do a good job of computing the costs of inserting and deleting characters. Here is a diff listing (the numbers will be off, that's why I did it with context) which fixes the problem. It also fixes a long standing problem (which is in ALL the terminal drivers) of computing the "baud factor". The formula used in the stock emacs is 1) Special case to the Concept-100 and is "based on an analysis of the interrupt routine" in it, therefore not necessarily applicable to other terminals, and 2) negative at 19.2k baud. I have replaced it with a simple, straightforward calculation which seems to do a pretty good job. The diff listing follows. =Spencer *** old --- new *************** *** 14,15 #include #include "config.h" --- 14,16 ----- #include + #include #include "config.h" *************** *** 230,233 PC = 0; ! BaudFactor = 1 / (1 - (.45 +.3 * BaudRate / 9600.)) ! * (BaudRate / 10000.); if (CursStr == 0 || UP == 0 || ELstr == 0 || ESstr == 0) { --- 235,237 ----- PC = 0; ! BaudFactor = BaudRate / 10000.; if (CursStr == 0 || UP == 0 || ELstr == 0 || ESstr == 0) { *************** *** 240,243 } ! tt.t_ILmf = BaudFactor * 0.75; ! tt.t_ILov = ILstr ? 2 : MissingFeature; if (!ILstr) --- 244,251 ----- } ! if (ILstr) ! costof(ILstr, &ov, &mf); ! else ! ov = mf = MissingFeature; ! tt.t_ILmf = mf; ! tt.t_ILov = ov; if (!ILstr) *************** *** 247,252 if (ICstr && DCstr) { ! tt.t_ICov = 1; ! tt.t_ICov = 4; ! tt.t_DCmf = 2; ! tt.t_DCov = 0; } --- 255,267 ----- if (ICstr && DCstr) { ! costof(ICstr, &ov, &mf); ! tt.t_ICov = ov + (ICPstr ? mf : 0); ! if (ICPstr) ! costof(ICPstr, &ov, &mf); ! else ! ov = mf + 1; ! tt.t_ICmf = ov; ! ! tt.t_DCov = tt.t_ICov; ! costof(DCstr, &ov, &mf); ! tt.t_DCmf = ov + mf; } *************** *** 253,254 else { ! tt.t_ICov = MissingFeature; tt.t_ICov = MissingFeature; --- 268,270 ----- else { ! tt.t_ICmf = MissingFeature; tt.t_ICov = MissingFeature; *************** *** 263,264 --- 278,286 ----- + static + costof (str, ov, mf) + char *str; + int *ov, *mf; + { + register char *cp; + int pad; + *ov = *mf = pad = 0; + for (cp = str; isdigit(*cp); cp++) + pad = pad * 10 + (*cp - '0'); + if (*cp == '*') + { + *mf = pad * BaudFactor; + cp++; + } + else + *ov = pad; + *ov += strlen(cp); + return *ov; + } + static