]> git.wh0rd.org Git - nano.git/commitdiff
handle unspecified foreground colors
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 15 Jul 2005 00:17:13 +0000 (00:17 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 15 Jul 2005 00:17:13 +0000 (00:17 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2866 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/color.c

index 403875f27b29bce6d4bdd281c41351794b9e63cd..97bead029751c1e7565d88f1760934d6b5664f97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,11 +40,12 @@ CVS code -
          color_to_short()), and parse_colors(). (DLR)
        - Change color handling to save only the regex strings
          constantly, and to actually compile them on an as-needed
-         basis.  Also, don't bother doing complete refreshes of the
-         screen when color support is enabled if there's no regex
-         associated with the current file.  Changes to update_color()
-         (renamed color_update()), thanks_for_all_the_fish(),
-         do_input(), and do_output(). (Brand Huntsman and DLR)
+         basis.  Also, handle unspecified foreground colors, and don't
+         bother doing complete refreshes of the screen when color
+         support is enabled if there's no regex associated with the
+         current file.  Changes to update_color() (renamed
+         color_update()), thanks_for_all_the_fish(), do_input(), and
+         do_output(). (Brand Huntsman and DLR)
 - files.c:
   open_file()
        - Assert that filename isn't NULL, and don't do anything special
index ccc7a6979804feb4bce33a2640f9d86a82094b7c..451920934415cc40cec9e4bf1aff17ff51fc445a 100644 (file)
@@ -83,7 +83,13 @@ void color_init(void)
 
        for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
                tmpcolor = tmpcolor->next) {
-           short background = tmpcolor->bg;
+           short foreground = tmpcolor->fg, background = tmpcolor->bg;
+           if (foreground == -1) {
+#ifdef HAVE_USE_DEFAULT_COLORS
+               if (!defok)
+#endif
+                   foreground = COLOR_WHITE;
+           }
 
            if (background == -1) {
 #ifdef HAVE_USE_DEFAULT_COLORS
@@ -92,7 +98,7 @@ void color_init(void)
                    background = COLOR_BLACK;
            }
 
-           init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
+           init_pair(tmpcolor->pairnum, foreground, background);
 
 #ifdef DEBUG
            fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n",