commit ba2807c6f7b29ff699e72397acb0b8b90eb71af1
parent 3899a09deaa59aba3e7aab6cf375664bd2a5c352
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 13 Jun 2020 13:24:52 +0200
tweaks: call use_default_colors() just once for each run
Diffstat:
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/color.c b/src/color.c
@@ -38,6 +38,9 @@
#define A_BANDAID A_NORMAL
#endif
+static bool using_defaults = FALSE;
+ /* Whether ncurses will accept -1 to mean "default color". */
+
/* Assign a pair number to each of the foreground/background color combinations
* in the given syntax, giving identical combinations the same number. */
void set_syntax_colorpairs(syntaxtype *sntx)
@@ -59,8 +62,6 @@ void set_syntax_colorpairs(syntaxtype *sntx)
/* Initialize the color pairs for nano's interface. */
void set_interface_colorpairs(void)
{
- bool using_defaults = FALSE;
-
#ifdef HAVE_USE_DEFAULT_COLORS
/* Allow using the default colors, if available. */
using_defaults = (use_default_colors() != ERR);
@@ -99,14 +100,8 @@ void set_interface_colorpairs(void)
void prepare_palette(void)
{
const colortype *ink;
- bool using_defaults = FALSE;
short foreground, background;
-#ifdef HAVE_USE_DEFAULT_COLORS
- /* Allow using the default colors, if available. */
- using_defaults = (use_default_colors() != ERR);
-#endif
-
/* For each coloring expression, initialize the color pair. */
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
foreground = ink->fg;