bug-ncurses
[Top][All Lists]
Advanced

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

Re: attroff and COLOR_PAIR


From: Dulek
Subject: Re: attroff and COLOR_PAIR
Date: Tue, 26 Oct 2010 16:23:20 -0700 (PDT)

So what can I do about it? How to make a workaround?


Thomas Dickey-2 wrote:
> 
> On Tue, 26 Oct 2010, Dulek wrote:
> 
>> Look at this piece of code:
>>
>> attron(COLOR_PAIR(1));
>> addstr("a");
>> attron(COLOR_PAIR(2));
>> addstr("b");
>> attroff(COLOR_PAIR(2));
>> addstr("c");
>> attroff(COLOR_PAIR(1));
>> refresh();
>>
>> According to  http://www.mkssoftware.com/docs/man3/curs_attr.3.asp manual
>> :
> 
> fwiw, the mks page is an old port of ncurses (from the late 1990's iirc).
> 
> There's a current set of manpages on my website, e.g.,
> 
> http://invisible-island.net/ncurses/man/curs_attr.3x.html
> 
>> The routine attroff() turns off the named attributes without turning any
>> other attributes on or off.
>>
>> This means, that this code should display 'a' in COLOR_PAIR(1) color, 'b'
>> in
>> COLOR_PAIR(2) color, and 'c' in COLOR_PAIR(1) color. Unfortunately 'c' is
>> displayed in default terminal color. Why this is happening?
> 
> As far as attron/attroff are concerned, the whole field masked by A_COLOR
> is a single attribute.
> 
> By the way, this is an extension from X/Open, because it accepts color as 
> one of the attributes (matching the SVr4 implementation).  X/Open only 
> defines attr_on/attr_off, which separates color from the other attributes 
> (because it's allowing for color pairs past the 6-8 bits used for 
> implementing A_COLOR).
> 
> -- 
> Thomas E. Dickey
> http://invisible-island.net
> ftp://invisible-island.net
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses
> 
> 

-- 
View this message in context: 
http://old.nabble.com/attroff-and-COLOR_PAIR-tp30062568p30062715.html
Sent from the Gnu - Ncurses mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]