lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.4dev.10] default color in style files


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.10] default color in style files
Date: Fri, 20 Oct 2000 01:52:43 -0400
User-agent: Mutt/1.2i

This patch restores support for default colors specified in lss files.

Additionally, it moves recognition of default-color directive earlier
in the parsing process, so that the default color directive has the
same semantic as any other directive: it can be anywhere in the lss
file, and the first declaration overrides the next one.

Enjoy,
Ilya

--- ./src/LYReadCFG.c-ini       Sun Oct 15 04:29:44 2000
+++ ./src/LYReadCFG.c   Sun Oct 15 04:21:00 2000
@@ -366,6 +366,8 @@ PRIVATE int ColorCode ARGS1(
 #define ColorCode(color) (color)
 #endif
 
+int default_color_reset = 0;
+
 /*
  *  Validator for COLOR fields.
  */
@@ -378,7 +380,8 @@ PUBLIC int check_color ARGS2(
     CTRACE((tfp, "check_color(%s,%d)\n", color, the_default));
     if (!strcasecomp(color, "default")) {
 #if USE_DEFAULT_COLORS
-       the_default = DEFAULT_COLOR;
+       if (!default_color_reset)
+           the_default = DEFAULT_COLOR;
 #endif /* USE_DEFAULT_COLORS */
        CTRACE((tfp, "=> %d\n", the_default));
        return the_default;
--- ./src/LYReadCFG.h-ini       Thu Jan  6 22:02:22 2000
+++ ./src/LYReadCFG.h   Sun Oct 15 04:16:24 2000
@@ -39,6 +39,7 @@
 
 extern int default_fg;
 extern int default_bg;
+extern int default_color_reset;
 
 #if HAVE_USE_DEFAULT_COLORS && USE_DEFAULT_COLORS
 extern int lynx_default_colors NOPARAMS;
--- ./src/LYStyle.c-ini Sun Oct 15 04:31:52 2000
+++ ./src/LYStyle.c     Sun Oct 15 16:53:40 2000
@@ -133,6 +133,7 @@ PRIVATE void parse_attributes ARGS5(char
        CTRACE((tfp, "CSS(DEF):default_fg=%d, default_bg=%d\n", fA, bA));
        default_fg = fA;
        default_bg = bA;
+       default_color_reset = 1;
        return;
     }
     if (fA == NO_COLOR) {
@@ -411,7 +412,9 @@ PUBLIC void parse_userstyles NOARGS
 }
 
 
-/* Add a STYLE: option line to our list */
+/* Add a STYLE: option line to our list.  Process "default:" early
+   for it to have the same semantic as other lines: works at any place
+   of the style file, the first line overrides the later ones. */
 PRIVATE void HStyle_addStyle ARGS1(char*,buffer)
 {
     char *name = NULL;
@@ -419,6 +422,15 @@ PRIVATE void HStyle_addStyle ARGS1(char*
     if (lss_styles == NULL)
        lss_styles = HTList_new();
     strtolower(name);
+    if (!strncasecomp(name, "default:", 8)) /* default fg/bg */
+    {
+       CTRACE( (tfp, "READCSS.default%s:%s\n",
+                (default_color_reset ? ".ignore" : ""),
+                name ? name : "!?! empty !?!"));
+       if (!default_color_reset)
+           parse_style(name);
+       return;                         /* do not need to process it again */
+    }
     CTRACE((tfp, "READCSS:%s\n", name ? name : "!?! empty !?!"));
     HTList_addObject (lss_styles, name);
 }
--- ./src/LYCurses.c-ini        Thu Sep 21 21:21:58 2000
+++ ./src/LYCurses.c    Sun Oct 15 17:02:56 2000
@@ -469,7 +469,7 @@ PUBLIC int lynx_default_colors NOARGS
     int code = 0;
     if (lynx_called_initscr) {
        code = -1;
-       if (use_default_colors() == OK) {
+       if (!default_color_reset && use_default_colors() == OK) {
            default_fg = DEFAULT_COLOR;
            default_bg = DEFAULT_COLOR;
            code = 1;

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]