`more` tabs wrong ly
liberte at uiucdcs.UUCP
liberte at uiucdcs.UUCP
Fri Oct 12 16:26:00 AEST 1984
Index: ucb/more/more.c 4.2bsd FIX
Description:
`More` does not expand tabs when it should, and when it does,
it does so incorrectly. `More` should expand tabs itself rather
than leaving it to the kernal because in many circumstances
`more` will output terminal control characters to do things like
erase the page or a line. These chars may be counted by the kernal
in its effort to emulate hard tabs - thus "tabbing" too far.
When `more` did expand tabs (very rarely, if ever),
it would not expand adjacent tabs choosing instead to ignore
subsequent tabs.
The following fix may expand tabs in more cases than it should,
but at least it expands tabs when it should.
Repeat-By:
D'ja ever notice funny spacing in your `man` output?
If not, `stty -tabs; setenv MORE -c` and try again.
(For some reason, nroff
occasionally puts out tabs to move one character position.)
You can look at the characters actually being sent to your
terminal by using `script`.
Fix:
Condensed for your convenience.
*** older version
--- newer version
***************
* This older version contains the underlining fixes - plus my one
* addition to ignore the contradictory "ul" entry from the termcap.
--- 13,19 -----
** modified by Mark Callow, Qubix to correctly handle underlining
** on terminals such as tvi925's where CR's don't turn off
** attributes.
+ ** modified by Daniel LaLiberte, Uiucdcs to correctly expand tabs.
*/
#include <stdio.h>
***************
*** 686,694 << line numbers way off.
break;
}
*p++ = c;
! if (c == '\t')
! if (hardtabs && column < promptlen && !hard) {
! if (eraseln && !dumb) {
column = 1 + (column | 7);
- tputs (eraseln, 1, putch);
- promptlen = 0;
}
else {
! for (--p; column & 7 && p < &Line[LINSIZ - 1]; column++) {
! *p++ = ' ';
! }
if (column >= promptlen) promptlen = 0;
}
- }
- else
- column = 1 + (column | 7);
--- 687,698 ----- { just chop out the above and stick in the below }
break;
}
*p++ = c;
! if (c == '\t') {
! if (hardtabs && !hard && eraseln && !dumb) { /* too much? */
! if (column < promptlen) {
! tputs (eraseln, 1, putch);
! promptlen = 0;
! }
column = 1 + (column | 7);
}
else {
! --p;
! do *p++ = ' ';
! while ((++column & 7) && (p < &Line[LINSIZ - 1]));
if (column >= promptlen) promptlen = 0;
}
! }
Daniel LaLiberte (ihnp4!uiucdcs!liberte)
U of Illinois, Urbana-Champaign, Computer Science
{moderation in all things - including moderation}
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list