tweaks: call use_default_colors() just once for each run
parent
3899a09dea
commit
ba2807c6f7
11
src/color.c
11
src/color.c
|
@ -38,6 +38,9 @@
|
||||||
#define A_BANDAID A_NORMAL
|
#define A_BANDAID A_NORMAL
|
||||||
#endif
|
#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
|
/* Assign a pair number to each of the foreground/background color combinations
|
||||||
* in the given syntax, giving identical combinations the same number. */
|
* in the given syntax, giving identical combinations the same number. */
|
||||||
void set_syntax_colorpairs(syntaxtype *sntx)
|
void set_syntax_colorpairs(syntaxtype *sntx)
|
||||||
|
@ -59,8 +62,6 @@ void set_syntax_colorpairs(syntaxtype *sntx)
|
||||||
/* Initialize the color pairs for nano's interface. */
|
/* Initialize the color pairs for nano's interface. */
|
||||||
void set_interface_colorpairs(void)
|
void set_interface_colorpairs(void)
|
||||||
{
|
{
|
||||||
bool using_defaults = FALSE;
|
|
||||||
|
|
||||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||||
/* Allow using the default colors, if available. */
|
/* Allow using the default colors, if available. */
|
||||||
using_defaults = (use_default_colors() != ERR);
|
using_defaults = (use_default_colors() != ERR);
|
||||||
|
@ -99,14 +100,8 @@ void set_interface_colorpairs(void)
|
||||||
void prepare_palette(void)
|
void prepare_palette(void)
|
||||||
{
|
{
|
||||||
const colortype *ink;
|
const colortype *ink;
|
||||||
bool using_defaults = FALSE;
|
|
||||||
short foreground, background;
|
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 each coloring expression, initialize the color pair. */
|
||||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
|
||||||
foreground = ink->fg;
|
foreground = ink->fg;
|
||||||
|
|
Loading…
Reference in New Issue