Subject: misc/11052: xterm "tput reset" fails to rset SGR
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 09/20/2000 19:34:23
>Number:         11052
>Category:       misc
>Synopsis:       xterm "tput reset" fails to rset SGR
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 20 19:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Hawkinson
>Release:        netbsd-1-5 of 15 Aug 2000
>Organization:
MIT
>Environment:
	
System: NetBSD zorkmid.mit.edu 1.5E NetBSD 1.5E (ZORKMID-$Revision: 1.2 $) #54: Fri Aug 18 01:53:49 EDT 2000 jhawk@zorkmid.mit.edu:/usr/local/netbsd-current/src/sys/arch/i386/compile/ZORKMID i386


>Description:

	"tput init" fails to reset SGR characteristics (e.g. blink)
in an xterm. The problem is that the reset string outputs DECSC
and DECRC around the rest of the reset string, and instead of merely
saving the cursor position, SC/RC also save the SGR characteristics.

	"tput reset" fails to do anything at all, which is counterintuitive.
	
>How-To-Repeat:
	
Enter standout mode (explicitly, or by getting left that way from
a confused application. My usual case is running mutt over an ssh connection
and having the network fall out from under me, usually because I've
lost wireless network, by getting on the train or something ;-)):

zorkmid% cat
^[[5m

Examine the reset sequence:

zorkmid% tput init | cat -v
^[7^[[r^[[m^[[?7h^[[?1;3;4;6l^[[4l^[8^[>zorkmid% 

That's: DECSC (Save cursor), DECSTBM (scrolling region), SGR (char
attributes), DECSET (various), DECRST (various), RM (replace mode), DECRC
(restore cursor).

Try it and watch it fail:

zorkmid% tput init
zorkmid% 

	
>Fix:
	
	Not sure how this stuff is supposed to work. Is it an xterm bug?
	or a termcap lib bug? Or a termcap entry bug?

	It seems mightly peculiar, also, that "tput -Tvt100 init" and
	"tput -Tvt100 reset" do nothing at all.

	Perhaps someone should note this in tput(1)'s BUGS section :-(
>Release-Note:
>Audit-Trail:
>Unformatted: