slang-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] SLtt_initialize() Is_Fg_BGR vs. Is_Bg_BGR


Leonard den Ottolander <s-lang@xxxxxxxxxxxxx> wrote:
>In SLtt_initialize() the assignments of Is_Fg_BGR have been commented
>out and the variable has been dropped, but Is_Bg_BGR is still available
>as a variable. Don't we need the first variable any more? And doesn't
>the second need to be set conditionally?

  The first variable (Is_Fg_BGR) was set but has never been used for
  anything.

>Pavel Shirshov recently fixed the internal slang version for mc to set
>Is_Bg_BGR (instead of Is_Fg_BGR) after the assignment of Color_Bg_Str on
>line 2562 in sldisply.c. Could this typo have been the cause of why
>you've dropped that variable Is_Fg_BGR altogether?

  Looking at the code, I can see how a typo could have caused
  Is_Fg_BGR to never be used.  Does this patch address the issue?
  Thanks, --John

--- sldisply.c~	2006-02-05 14:56:06.000000000 -0500
+++ sldisply.c	2006-02-15 10:28:27.000000000 -0500
@@ -158,7 +158,7 @@
 static Brush_Info_Type Brush_Table[JMAX_COLORS];
 
 /* 0 if least significant bit is blue, not red */
-/* static int Is_Fg_BGR = 0; */
+static int Is_Fg_BGR = 0;
 static int Is_Bg_BGR = 0;
 #define COLOR_ARG(color, is_bgr) ((is_bgr) ? RGB_to_BGR[(color)&0x7] : (color))
 static SLCONST int RGB_to_BGR[] =
@@ -1394,7 +1394,7 @@
 	     if (fg0 == SLSMG_COLOR_DEFAULT)
 	       tt_write_string (Default_Color_Fg_Str);
 	     else
-	       tt_printf (Color_Fg_Str, COLOR_ARG(fg0, Is_Bg_BGR), 0);
+	       tt_printf (Color_Fg_Str, COLOR_ARG(fg0, Is_Fg_BGR), 0);
 	  }
 
 	if (unknown_attributes
@@ -2554,13 +2554,13 @@
    if (Color_Fg_Str == NULL)
      {
 	Color_Fg_Str = SLtt_tgetstr ("Sf");   /* setf */
-	/* Is_Fg_BGR = (Color_Fg_Str != NULL); */
+	Is_Fg_BGR = (Color_Fg_Str != NULL);
      }
    Color_Bg_Str = SLtt_tgetstr ("AB"); /* ANSI setbf */
    if (Color_Bg_Str == NULL)
      {
 	Color_Bg_Str = SLtt_tgetstr ("Sb");   /* setb */
-	/* Is_Fg_BGR = (Color_Bg_Str != NULL); */
+	Is_Bg_BGR = (Color_Bg_Str != NULL);
      }
 
    if ((Max_Terminfo_Colors = SLtt_tgetnum ("Co")) < 0)

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]