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: gnats-bugs%netbsd.org@localhost
Cc: blymn%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
        Thomas Klausner <wiz%NetBSD.org@localhost>
Subject: Re: lib/55220: Possible color problem in curses and/or py-curses
Date: Fri, 3 Dec 2021 17:12:02 +1030

 --7+wQ6I/tGyRaxYE+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 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"
 
 --7+wQ6I/tGyRaxYE+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch
 
 --- _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);
 
 --7+wQ6I/tGyRaxYE+--
 


Home | Main Index | Thread Index | Old Index