NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/55474: wattroff unsets all attributes if passed STANDOUT as argument



The following reply was made to PR lib/55474; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/55474: wattroff unsets all attributes if passed STANDOUT as
 argument
Date: Fri, 10 Jul 2020 00:54:19 +0300

 On Thu, Jul 09, 2020 at 20:15:00 +0000, jnaman806%gmail.com@localhost wrote:
 
 > The attroff() and wattroff() functions turn off attrs in the current
 > or specified window "without affecting any others".
 > 
 > But if passed STANDOUT (1<<8) as an argument, it turns off all
 > attributes. This is because of usage of wstandend() in line#468
 > https://github.com/NetBSD/src/blob/161821ccfdc43542c5d7b008a4057f0bcea38217/lib/libcurses/attributes.c#L468 .
 > 
 > wstandend() unsets all the attributes.
 
 I've noticed this problem when I was refactoring this code a while
 back, but ultimately decided to leave it as it is.
 
 The standard is somewhat unclear. It says that "the standend() and
 wstandend() functions turn off all attributes of the current or
 specified window."  Now, should attroff(A_STANDOUT) be equivalent to
 standend()?  Yes, for attroff() there is that passage about "without
 affecting any others", but it is kinda false for A_STANDOUT by
 construction, as standout is not a separate attribute but an alias for
 the "best highlighting mode of the terminal".  So using A_STANDOUT
 combined with anything is already a rather dubious thing to do.
 
 To fix this properly (for some values of "fix" and "properly") we
 should switch refresh code to use sgr directly I think.
 
 -uwe
 


Home | Main Index | Thread Index | Old Index