[net.unix-wizards] Fix for a bug in 4.2 curses

haynes%Berkeley@ucscc.UUCP (08/01/85)

Pardon me if you've seen something like this already - we had not.

	From whitney Wed Jul 31 13:28:57 1985
	Received: by ucsce.UCSC (4.12/4.7)
		id AA03684; Wed, 31 Jul 85 13:28:46 pdt
	Date: Wed, 31 Jul 85 13:28:46 pdt
	From: whitney (50610000)
	Message-Id: <8507312028.AA03684@ucsce.UCSC>
	To: haynes, root
	Subject: diff output -- changes to curses file cr_tty.c
	
	Changes made to cr_tty.c in curses source library to handle destructive
	highlighting on tvi's and other terminals that send a destructive string
	for these attributes.  Prepared with the following:
	
		% diff cr_tty.c newcr_tty.c
	
	====================================================
	4a5,8
	>  *
	>  *	Modified to handle destructive highlight (reverse and underlining)
	>  *	attributes as found in tvi's.
	> ucsce whitney Wed Jul 31 13:17:35 PDT 1985
	104a109,117
	>  *
	>  *	Fixed problems with destructive reverse/underline attributes as on
	>  *	tvi912's.  Wastes some space in tspace since it duplicates these
	>  *	strings after prepending the correct number of backspaces.  This
	>  *	will erase chars to the left of the highlighted string if they
	>  *	are not blank.  The effect will be directly proportional to the
	>  *	the length of the destructive termcap string.  On tvi's, it will
	>  *	be a single space that is effected.
	> ucsce whitney Wed Jul 31 13:15:12 PDT 1985
	111a125,128
	> 	int  i;						/* some variable used in the hack. jw.*/
	> 	int  j;
	> 	int  k;
	> 
	143,146c160,190
	< 	if (tgetnum("sg") > 0)
	< 		SO = NULL;
	< 	if (tgetnum("ug") > 0)
	< 		US = NULL;
	---
	> 
	> 	/* Another solution (perhaps the best) is to change tgetstr() from
	> 	 * the termlib library so that it makes the substitution as needed.
	> 	 *		jw.
	> 	 */
	> 
	> 	if ((j = tgetnum("sg")) > 0) {
	> 
	> 		for ( k = strlen(BC), i=0, namp = aoftspace; i < j; i++) {
	> 			strcpy(aoftspace, BC);
	> 			aoftspace += k;
	> 		}
	>         strcpy(aoftspace, SO);
	> 		aoftspace += strlen(SO)+1;
	> 		SO = namp;
	> 
	> 	}	/* end if */
	> 
	> 	if ((j = tgetnum("ug")) > 0) {
	> 
	> 		for ( k = strlen(BC), i=0, namp = aoftspace; i < j; i++) {
	> 			strcpy(aoftspace, BC);
	> 			aoftspace += k;
	> 		}
	>         strcpy(aoftspace, US);
	> 		aoftspace += strlen(US)+1;
	> 		US = namp;
	> 	}	/* end if */
	> 
	> 	/* end hack. jw. */
	>