handle unspecified foreground colors

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2866 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-15 00:17:13 +00:00
parent 26ee759503
commit 8f948fa1eb
2 changed files with 14 additions and 7 deletions

View File

@ -40,11 +40,12 @@ CVS code -
color_to_short()), and parse_colors(). (DLR) color_to_short()), and parse_colors(). (DLR)
- Change color handling to save only the regex strings - Change color handling to save only the regex strings
constantly, and to actually compile them on an as-needed constantly, and to actually compile them on an as-needed
basis. Also, don't bother doing complete refreshes of the basis. Also, handle unspecified foreground colors, and don't
screen when color support is enabled if there's no regex bother doing complete refreshes of the screen when color
associated with the current file. Changes to update_color() support is enabled if there's no regex associated with the
(renamed color_update()), thanks_for_all_the_fish(), current file. Changes to update_color() (renamed
do_input(), and do_output(). (Brand Huntsman and DLR) color_update()), thanks_for_all_the_fish(), do_input(), and
do_output(). (Brand Huntsman and DLR)
- files.c: - files.c:
open_file() open_file()
- Assert that filename isn't NULL, and don't do anything special - Assert that filename isn't NULL, and don't do anything special

View File

@ -83,7 +83,13 @@ void color_init(void)
for (tmpcolor = openfile->colorstrings; tmpcolor != NULL; for (tmpcolor = openfile->colorstrings; tmpcolor != NULL;
tmpcolor = tmpcolor->next) { 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) { if (background == -1) {
#ifdef HAVE_USE_DEFAULT_COLORS #ifdef HAVE_USE_DEFAULT_COLORS
@ -92,7 +98,7 @@ void color_init(void)
background = COLOR_BLACK; background = COLOR_BLACK;
} }
init_pair(tmpcolor->pairnum, tmpcolor->fg, background); init_pair(tmpcolor->pairnum, foreground, background);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n",