Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site uiucdcs.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!hao!hplabs!tektronix!uw-beaver!cornell!vax135!houxm!ihnp4!inuxc!pur-ee!uiucdcs!liberte
From: liberte@uiucdcs.UUCP
Newsgroups: net.bugs.4bsd
Subject: `more` tabs wrong	ly
Message-ID: <8200024@uiucdcs.UUCP>
Date: Fri, 12-Oct-84 02:26:00 EDT
Article-I.D.: uiucdcs.8200024
Posted: Fri Oct 12 02:26:00 1984
Date-Received: Sat, 13-Oct-84 03:35:06 EDT
Lines: 88
Nf-ID: #N:uiucdcs:8200024:000:2616
Nf-From: uiucdcs!liberte    Oct 11 01:26:00 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 
***************
*** 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}