nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d1e1438ca0348a6f9f1f55623b0a1d546364069f
parent 382ec84248a5985f2629d32ad8580753ea02ddf5
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 28 Apr 2020 16:43:11 +0200

tweaks: delete some unneeded code, and rename the function accordingly

When set_colorpairs() is called, no files have been loaded yet, so
no syntaxes will have been loaded yet either.  Thus it is pointless
to run through the list of available syntaxes.

Diffstat:
Msrc/color.c | 10++--------
Msrc/nano.c | 2+-
Msrc/proto.h | 2+-
3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/color.c b/src/color.c @@ -61,9 +61,8 @@ void set_syntax_colorpairs(syntaxtype *sntx) } } -/* Initialize the colors for nano's interface, and assign pair numbers - * for the colors in each loaded syntax. */ -void set_colorpairs(void) +/* Initialize the color pairs for nano's interface. */ +void set_interface_colorpairs(void) { bool using_defaults = FALSE; @@ -102,11 +101,6 @@ void set_colorpairs(void) free(color_combo[index]); } - - /* For each loaded syntax, assign pair numbers to color combinations. */ - for (syntaxtype *sntx = syntaxes; sntx != NULL; sntx = sntx->next) - if (sntx->filename == NULL) - set_syntax_colorpairs(sntx); } /* Initialize the color pairs for the current syntax. */ diff --git a/src/nano.c b/src/nano.c @@ -2254,7 +2254,7 @@ int main(int argc, char **argv) started_curses = TRUE; #ifdef ENABLE_COLOR - set_colorpairs(); + set_interface_colorpairs(); #else interface_color_pair[TITLE_BAR] = hilite_attribute; interface_color_pair[LINE_NUMBER] = hilite_attribute; diff --git a/src/proto.h b/src/proto.h @@ -242,7 +242,7 @@ bool is_valid_unicode(wchar_t wc); /* Most functions in color.c. */ #ifdef ENABLE_COLOR -void set_colorpairs(void); +void set_interface_colorpairs(void); void prepare_palette(void); void find_and_prime_applicable_syntax(void); void set_up_multicache(linestruct *line);