NetBSD-Bugs archive

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

Re: lib/55220: Possible color problem in curses and/or py-curses



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

From: Brett Lymn <blymn%internode.on.net@localhost>
To: Thomas Klausner <wiz%NetBSD.org@localhost>
Cc: gnats-bugs%netbsd.org@localhost
Subject: Re: lib/55220: Possible color problem in curses and/or py-curses
Date: Tue, 14 Dec 2021 17:04:51 +1030

 --VyBCHPmlEpLtvs2o
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Mon, Dec 06, 2021 at 05:38:52PM +0100, Thomas Klausner wrote:
 > On Mon, Dec 06, 2021 at 07:40:58AM +1030, Brett Lymn wrote:
 > > On Sat, Dec 04, 2021 at 09:24:42PM +0100, Thomas Klausner wrote:
 > > > 
 > > > I tried fileobj with this, and I still see some weirdness (but perhaps
 > > > that is what you meant with the colour pair 0 question?):
 > > > 
 > > 
 > > Yes, that is what I was talking about.  I am sure it works fine in ncurses I suspect because
 > > the ncurses chgat() won't update the colour if the pair number is 0.  I am sure our colour
 > > handling is correct because the output matches screenshots out on the internet, chgat is
 > > only called when the cursor moves.  I will have a look at the chgat code now the attributes
 > > are coming through.
 > 
 > Ok, thanks. Let me know if the python code needs more changes.
 > 
 
 The attached patch fixes the weirdness.  I haven't committed the fix yet
 because it seems a bit hacky to me, I am consulting with the other
 developers that work on curses to see what they think.  It looks like
 ncurses treats colour pair 0 as "special" sometimes, NetBSD curses
 doesn't do that - it will be awkward if we don't follow the ncurses
 model though.
 
 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.
 
 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"
 
 --VyBCHPmlEpLtvs2o
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="chgat.diff"
 
 Index: chgat.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/chgat.c,v
 retrieving revision 1.8
 diff -r1.8 chgat.c
 63a64,66
 > 	__CTRACE(__CTRACE_ATTR, "mvwchgat: x: %d y: %d count: %d attr: 0x%x "
 > 	    "color pair %d\n", x, y, count, (attr & ~__COLOR),
 > 	    color);
 69,70d71
 < 	attr = (attr & ~__COLOR) | COLOR_PAIR(color);
 < 
 74,76d74
 < 	__CTRACE(__CTRACE_ATTR, "mvwchgat: x: %d y: %d count: %d attr: 0x%x "
 < 	    "color pair %d\n", x, y, count, (attr & ~__COLOR),
 < 	    PAIR_NUMBER(color));
 89c87,92
 < 		lc->attr = (lc->attr & ~WA_ATTRIBUTES) | attr;
 ---
 > 		if (color == 0)
 > 			lc->attr = (lc->attr & ~__COLOR) | __default_color
 > 				    | (lc->attr & ~WA_ATTRIBUTES) | attr;
 > 		else
 > 			lc->attr = (lc->attr & ~__COLOR) | COLOR_PAIR(color)
 > 				    | (lc->attr & ~WA_ATTRIBUTES) | attr;
 
 --VyBCHPmlEpLtvs2o--
 


Home | Main Index | Thread Index | Old Index