[net.bugs.4bsd] Bug in tset

z@cca.UUCP (Steve Zimmerman) (04/29/84)

Description:
	tset(1) does not initialize tabs correctly on terminals with
	settable tab stops.  Specifically, it does not set a tab at
	column 0, so that a tab given from column 72 on a terminal with
	auto wrap will incorrectly tab to column 8 on the next line,
	instead of column 0.
Repeat-By:
	Take a terminal with settable tab stops and auto wrap and issue
	the tset(1) command.  Put the terminal in local mode and keep
	hitting the tab key; notice that after column 72 the next tab
	stop is at column 8.
Fix:

*** tset.c~	Tue Apr  3 00:26:01 1984
--- tset.c	Sun Apr 29 14:21:11 1984
***************
*** 1291,1297
  		tputs(clear_tabs, 0, prc);
  	}
  	if (set_tab) {
! 		for (c=8; c<columns; c += 8) {
  			/* get to that column. */
  			tg_out = "OOPS";	/* also returned by tgoto */
  			if (set_column)

--- 1291,1297 -----
  		tputs(clear_tabs, 0, prc);
  	}
  	if (set_tab) {
! 		for (c=0; c<columns; c += 8) {
  			/* get to that column. */
  			tg_out = "OOPS";	/* also returned by tgoto */
  			if (set_column)

rpw3@fortune.UUCP (05/01/84)

#R:cca:-37600:fortune:2000012:000:868
fortune!rpw3    Apr 30 14:16:00 1984

+--------------------
| Take a terminal with settable tab stops and auto wrap and issue
| the tset(1) command.  Put the terminal in local mode and keep
| hitting the tab key; notice that after column 72 the next tab
| stop is at column 8.
+--------------------

This is a problem? I recall when implementing a line printer driver
at a certain DEC-10 site many moons ago that I had to duplicate this
exact behaviour (i.e., tab from EOL gets col. 9 of next line), 'cause
"that's the way the DEC printer works". Apparently the users depended
on wrapped lines being tabbed in one stop.

(Note that the normal terminolgy is columns 1 & 9, not 0 & 8. So default
tabs are at columns 9, 17, 25, ...)

Rob Warnock

UUCP:	{ihnp4,ucbvax!amd70,hpda,harpo,sri-unix,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphin Drive, Redwood City, CA 94065

z@cca.UUCP (Steve Zimmerman) (05/01/84)

Yes, this is a problem.  Aside from the fact that it is only logical
that a tab from the end of a line behave like every other tab (i.e,
advance no more than eight spaces), all terminals that I have seen with
hardwired tab stops do behave this way.  Furthermore, even those
terminals with user settable tab stops have a tab set in the first
column and every eight columns thereafter when they are initialized.
If the tab stops set by tset are different from default tab settings and
those on terminals with hardwired tab stops, then it becomes impossible
for programs to reliably know exactly where a terminal's tab stops are.

	Steve Zimmerman
	decvax!cca!z