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



On Thu, Dec 02, 2021 at 09:35:01PM +0000, Brett Lymn wrote:
>  
>  Which is also what I see when running debug on fileobj too - the
>  attributes and colour are _always_ 0 which translates to attribute
>  A_NORMAL and white text on a black background.  Having a look at the
>  py-curses library code in the chgat handling there is:
>  
>  
>      color = (short)((attr >> 8) & 0xff);
>      attr = attr - (color << 8);
>  
>  
>  This really doesn't map well to the NetBSD curses colour and attributes
>  so it isn't surprising that the NetBSD curses is always getting 0's.
>  

The attached patch works with the test code in the previous message and
improves the output in fileobj.  With the patch the colour highlighting
works but the address fields get set to colour pair 0. I it not clear to
me if the ncurses version of chgat ignores colour pair 0, if this is the
case then NetBSD curses will need to emulate this too.

-- 
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"
--- _cursesmodule.c.orig	2021-12-03 16:48:08.869573389 +1030
+++ _cursesmodule.c	2021-12-03 16:52:32.269195559 +1030
@@ -1077,8 +1077,8 @@
         return NULL;
     }
 
-    color = (short)((attr >> 8) & 0xff);
-    attr = attr - (color << 8);
+    color = (short) PAIR_NUMBER(attr);
+    attr = attr & __ATTRIBUTES;
 
     if (use_xy) {
         rtn = mvwchgat(self->win,y,x,num,attr,color,NULL);


Home | Main Index | Thread Index | Old Index