[Midnight Commander] #229: ncurses "default color" change to -1 when available

Robert David robert.david.public at gmail.com
Sat Jan 31 22:40:06 UTC 2009


On Saturday 31 January 2009 20:19:35 Ticket System wrote:
> #229: ncurses "default color" change to -1 when available
> -------------------------------------------+-------------------------------
>- Reporter:  robert.david.public at gmail.com  |        Type:  defect
>    Status:  new                            |    Priority:  major
> Milestone:  4.7                            |   Component:  mc-core
>   Version:  4.6.1                          |    Keywords:
>  Blocking:                                 |   Blockedby:
> -------------------------------------------+-------------------------------
>- When using ncurses, there is problem with setting default color to
> transparent on capable terminals. This is caused by color index going from
> 0+ but the default terminal color is -1 in ncurses. So mc doesnt show true
> default color, but BLACK. [[BR]]
>
>  This also has to be dependant on terminal support, if it supports default
>  colors or not. Good inspiration about this is in htop source -> CRT.c ->
>  CRT_setColors


So I have crated a simple patch for this.

Robert


--- a/src/color.c       2009-01-31 23:31:58.000000000 +0100
+++ b/src/color.c       2009-01-31 23:27:05.000000000 +0100
@@ -301,6 +301,7 @@
 
     if (use_colors){
        start_color ();
+       use_default_colors ();
        configure_colors ();
 
 #ifndef HAVE_SLANG
@@ -410,7 +411,7 @@
 void
 mc_init_pair (int index, CTYPE foreground, CTYPE background)
 {
-    init_pair (index, foreground, background);
+    init_pair (index, foreground, (background==0?-1:background));
     if (index > max_index)
        max_index = index;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncurses_default_color_fix.patch
Type: text/x-patch
Size: 498 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20090131/bc6f0ed6/attachment.bin>


More information about the mc-devel mailing list