bug-ncurses
[Top][All Lists]
Advanced

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

Re: Random inverted and underlined characters?


From: Thomas Dickey
Subject: Re: Random inverted and underlined characters?
Date: Tue, 17 Jan 2017 05:22:43 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jan 16, 2017 at 08:35:23PM -0700, elronnd wrote:
> I encountered this in a more complex program, but here's a minimal
> example:
> 
> #include <ncurses.h>
> 
> int main() {
>       unsigned short t = 1;
>       initscr();
>       start_color();
>       for (int i=0;i<80;i++) {
>               for (int j=0;j<25;j++) {
>                       init_pair(t, COLOR_WHITE, COLOR_BLACK);
>                       attron(COLOR_PAIR(t));

ultimately because

#define COLOR_PAIR(n)   NCURSES_BITS(n, 0)

doesn't "and" its value with A_COLOR (a minor bug), and when you ask for
a pair past the size it can use (A_COLOR), the "attron" macro uses more bits
than it should.

>                       mvprintw(j, i, "#");
>                       attroff(COLOR_PAIR(t));
>                       t++;
>               }
>       }
>       refresh();
>       getch();
>       endwin();
>       return 0;
> }
> 
> As you can see when you run it, a bunch of scattered characters are
> underlined or inverted.  This isn't affected by whether or not I put
> an attroff(A_UNDERLINE) or attroff(A_REVERSE) after the
> attronn(COLOR_PAIR(t)).  Why is this?
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-ncurses

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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