From d5ac1ed39513d6632aa4fe47ca1a5a90eb48c312 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 1 Nov 2017 19:45:33 +0100 Subject: [PATCH] tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR --- configure.ac | 22 +++++++++++----------- src/color.c | 4 ++-- src/cut.c | 4 ++-- src/files.c | 10 +++++----- src/global.c | 36 ++++++++++++++++++------------------ src/help.c | 6 +++--- src/nano.c | 24 ++++++++++++------------ src/nano.h | 8 ++++---- src/proto.h | 14 +++++++------- src/rcfile.c | 22 +++++++++++----------- src/search.c | 4 ++-- src/text.c | 8 ++++---- src/winio.c | 10 +++++----- 13 files changed, 86 insertions(+), 86 deletions(-) diff --git a/configure.ac b/configure.ac index 8fb8c0de..b8103ce6 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,15 @@ fi AC_ARG_ENABLE(color, AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting])) +if test "x$enable_tiny" = xyes; then + if test "x$enable_color" = xyes; then + if test "x$enable_nanorc" != xyes; then + AC_MSG_ERROR([--enable-color needs --enable-nanorc to work]) + fi + else + enable_color=no + fi +fi if test "x$enable_nanorc" = xno; then if test "x$enable_color" = xyes; then AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc]) @@ -83,9 +92,8 @@ if test "x$enable_nanorc" = xno; then enable_color=no fi fi -if test "x$enable_color" = xno; then - AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.]) -else +if test "x$enable_color" != xno; then + AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting.]) color_support=yes fi @@ -276,14 +284,6 @@ AC_ARG_ENABLE(tiny, AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size])) if test "x$enable_tiny" = xyes; then AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) - if test "x$enable_color" != xyes; then - AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.]) - color_support=no - else - if test "x$enable_nanorc" != xyes; then - AC_MSG_ERROR([--enable-color needs --enable-nanorc to work]) - fi - fi if test "x$enable_extra" != xyes; then AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.]) fi diff --git a/src/color.c b/src/color.c index bcda109c..a75c2a6f 100644 --- a/src/color.c +++ b/src/color.c @@ -28,7 +28,7 @@ #include #include -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* Initialize the colors for nano's interface, and assign pair numbers * for the colors in each syntax. */ @@ -424,4 +424,4 @@ void precalc_multicolorinfo(void) } } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ diff --git a/src/cut.c b/src/cut.c index 8521ad3a..daaa06c3 100644 --- a/src/cut.c +++ b/src/cut.c @@ -188,7 +188,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof) refresh_needed = TRUE; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR check_the_multis(openfile->current); #endif @@ -289,7 +289,7 @@ void do_uncut_text(void) refresh_needed = TRUE; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR check_the_multis(openfile->current); #endif diff --git a/src/files.c b/src/files.c index 28a71a41..27a8a506 100644 --- a/src/files.c +++ b/src/files.c @@ -107,7 +107,7 @@ void make_new_buffer(void) openfile->current_stat = NULL; openfile->lock_filename = NULL; #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR openfile->syntax = NULL; openfile->colorstrings = NULL; #endif @@ -496,7 +496,7 @@ bool open_buffer(const char *filename, bool undoable) openfile->placewewant = 0; } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* If we're loading into a new buffer, update the colors to account * for it, if applicable. */ if (new_buffer) @@ -573,7 +573,7 @@ void prepare_for_display(void) if (!inhelp) titlebar(NULL); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* If there are multiline coloring regexes, and there is no * multiline cache data yet, precalculate it now. */ if (openfile->syntax && openfile->syntax->nmultis > 0 && @@ -1922,14 +1922,14 @@ bool write_file(const char *name, FILE *f_open, bool tmp, if (method == OVERWRITE && !tmp) { /* If we must set the filename, and it changed, adjust things. */ if (!nonamechange && strcmp(openfile->filename, realname) != 0) { -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR const char *oldname, *newname; oldname = openfile->syntax ? openfile->syntax->name : ""; #endif openfile->filename = mallocstrcpy(openfile->filename, realname); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* See if the applicable syntax has changed. */ color_update(); color_init(); diff --git a/src/global.c b/src/global.c index 10097aaf..d20d9e45 100644 --- a/src/global.c +++ b/src/global.c @@ -51,7 +51,7 @@ int margin = 0; int editwincols = -1; /* The number of usable columns in the edit window: COLS - margin. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR bool have_palette = FALSE; /* Whether the colors for the current syntax have been initialized. */ #endif @@ -179,7 +179,7 @@ char *alt_speller = NULL; /* The command to use for the alternate spell checker. */ #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR syntaxtype *syntaxes = NULL; /* The global list of color syntaxes. */ char *syntaxstr = NULL; @@ -233,7 +233,7 @@ regmatch_t regmatches[10]; int hilite_attribute = A_REVERSE; /* The curses attribute we use to highlight something. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR char* specified_color_combo[] = {NULL}; /* The color combinations as specified in the rcfile. */ #endif @@ -670,7 +670,7 @@ void shortcut_init(void) const char *forwardfile_gist = N_("Go to the next file in the list"); const char *gotodir_gist = N_("Go to directory"); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR const char *lint_gist = N_("Invoke the linter, if available"); const char *prevlint_gist = N_("Go to previous linter msg"); const char *nextlint_gist = N_("Go to next linter msg"); @@ -779,7 +779,7 @@ void shortcut_init(void) add_to_funcs(do_spell, MMAIN, N_("To Spell"), WITHORSANS(spell_gist), TOGETHER, NOVIEW); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR add_to_funcs(do_linter, MMAIN, N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW); #ifdef ENABLE_SPELLER @@ -792,8 +792,8 @@ void shortcut_init(void) add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW); -#if (defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || !defined(DISABLE_COLOR)) || \ - !defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && defined(DISABLE_COLOR)) +#if (defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)) || \ + !defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_COLOR)) /* Conditionally placing this one here or further on, to keep the * help items nicely paired in most conditions. */ add_to_funcs(do_gotolinecolumn_void, MMAIN, @@ -906,8 +906,8 @@ void shortcut_init(void) N_("Next File"), WITHORSANS(nextfile_gist), BLANKAFTER, VIEW); #endif -#if (!defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || !defined(DISABLE_COLOR)) || \ - defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && defined(DISABLE_COLOR)) +#if (!defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)) || \ + defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_COLOR)) add_to_funcs(do_gotolinecolumn_void, MMAIN, gotoline_tag, WITHORSANS(gotoline_gist), BLANKAFTER, VIEW); #endif @@ -1072,7 +1072,7 @@ void shortcut_init(void) add_to_funcs(discard_buffer, MWRITEFILE, N_("Discard buffer"), WITHORSANS(discardbuffer_gist), BLANKAFTER, NOVIEW); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR add_to_funcs(do_page_up, MLINTER, /* TRANSLATORS: Try to keep the next two strings at most 20 characters. */ N_("Prev Lint Msg"), WITHORSANS(prevlint_gist), TOGETHER, VIEW); @@ -1110,7 +1110,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "^T", 0, do_spell, 0); add_to_sclist(MMAIN, "F12", 0, do_spell, 0); #else -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR add_to_sclist(MMAIN, "^T", 0, do_linter, 0); add_to_sclist(MMAIN, "F12", 0, do_linter, 0); #endif @@ -1244,7 +1244,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS); #endif add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR add_to_sclist(MMAIN, "M-Y", 0, do_toggle_void, NO_COLOR_SYNTAX); #endif @@ -1362,7 +1362,7 @@ void shortcut_init(void) #endif } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR void set_lint_or_format_shortcuts(void) { #ifdef ENABLE_SPELLER @@ -1383,7 +1383,7 @@ void set_spell_shortcuts(void) replace_scs_for(do_linter, do_spell); #endif } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ const subnfunc *sctofunc(const sc *s) { @@ -1507,7 +1507,7 @@ sc *strtosc(const char *input) !strcasecmp(input, "speller")) s->scfunc = do_spell; #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR else if (!strcasecmp(input, "linter")) s->scfunc = do_linter; #endif @@ -1677,7 +1677,7 @@ sc *strtosc(const char *input) s->toggle = SOFTWRAP; else if (!strcasecmp(input, "whitespacedisplay")) s->toggle = WHITESPACE_DISPLAY; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR else if (!strcasecmp(input, "nosyntax")) s->toggle = NO_COLOR_SYNTAX; #endif @@ -1801,7 +1801,7 @@ void thanks_for_all_the_fish(void) delete_opennode(openfile->prev); } delete_opennode(openfile); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR free(syntaxstr); while (syntaxes != NULL) { syntaxtype *sint = syntaxes; @@ -1848,7 +1848,7 @@ void thanks_for_all_the_fish(void) free(sint); } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ #ifdef ENABLE_HISTORIES /* Free the search, replace, and execute history lists. */ free_filestruct(searchtop); diff --git a/src/help.c b/src/help.c index 2116ae48..be1b3654 100644 --- a/src/help.c +++ b/src/help.c @@ -103,7 +103,7 @@ void do_help(void) int was_margin = margin; #endif ssize_t was_tabsize = tabsize; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR char *was_syntax = syntaxstr; #endif char *saved_answer = (answer != NULL) ? strdup(answer) : NULL; @@ -149,7 +149,7 @@ void do_help(void) margin = 0; #endif tabsize = 8; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR syntaxstr = "nanohelp"; #endif curs_set(0); @@ -251,7 +251,7 @@ void do_help(void) margin = was_margin; #endif tabsize = was_tabsize; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR syntaxstr = was_syntax; #endif diff --git a/src/nano.c b/src/nano.c index ba4fca9c..ff7c984f 100644 --- a/src/nano.c +++ b/src/nano.c @@ -71,7 +71,7 @@ filestruct *make_new_node(filestruct *prevnode) newnode->next = NULL; newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR newnode->multidata = NULL; #endif @@ -88,7 +88,7 @@ filestruct *copy_node(const filestruct *src) dst->prev = src->prev; dst->lineno = src->lineno; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR dst->multidata = NULL; #endif @@ -128,7 +128,7 @@ void unlink_node(filestruct *fileptr) void delete_node(filestruct *fileptr) { free(fileptr->data); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR free(fileptr->multidata); #endif free(fileptr); @@ -848,7 +848,7 @@ void usage(void) print_opt(_("-X "), _("--wordchars="), N_("Which other characters are word parts")); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (!ISSET(RESTRICTED)) print_opt(_("-Y "), _("--syntax="), N_("Syntax definition to use for coloring")); @@ -930,7 +930,7 @@ void version(void) #ifdef ENABLE_BROWSER printf(" --enable-browser"); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR printf(" --enable-color"); #endif #ifndef DISABLE_EXTRA @@ -976,7 +976,7 @@ void version(void) #ifndef ENABLE_BROWSER printf(" --disable-browser"); #endif -#ifdef DISABLE_COLOR +#ifndef ENABLE_COLOR printf(" --disable-color"); #endif #ifndef ENABLE_COMMENT @@ -1401,7 +1401,7 @@ void do_toggle(int flag) break; case WHITESPACE_DISPLAY: titlebar(NULL); /* Fall through. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR case NO_COLOR_SYNTAX: #endif refresh_needed = TRUE; @@ -1714,7 +1714,7 @@ int do_input(bool allow_funcs) refresh_needed = TRUE; } #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (f && !f->viewok) check_the_multis(openfile->current); #endif @@ -1882,7 +1882,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) openfile->placewewant = xplustabs(); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR check_the_multis(openfile->current); #endif @@ -1924,7 +1924,7 @@ int main(int argc, char **argv) {"tabsize", 1, NULL, 'T'}, {"quickblank", 0, NULL, 'U'}, {"version", 0, NULL, 'V'}, -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR {"syntax", 1, NULL, 'Y'}, #endif {"constantshow", 0, NULL, 'c'}, @@ -2122,7 +2122,7 @@ int main(int argc, char **argv) word_chars = mallocstrcpy(word_chars, optarg); break; #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR case 'Y': syntaxstr = mallocstrcpy(syntaxstr, optarg); break; @@ -2491,7 +2491,7 @@ int main(int argc, char **argv) mouse_init(); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR set_colorpairs(); #else interface_color_pair[TITLE_BAR] = hilite_attribute; diff --git a/src/nano.h b/src/nano.h index f47b7679..d9a9cb10 100644 --- a/src/nano.h +++ b/src/nano.h @@ -176,7 +176,7 @@ typedef enum { } undo_type; /* Structure types. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR typedef struct colortype { short fg; /* This syntax's foreground color. */ @@ -265,7 +265,7 @@ typedef struct lintstruct { /* Regex starts and ends within this line. */ #define CWOULDBE (1<<6) /* An unpaired start match on or before this line. */ -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ /* More structure types. */ typedef struct filestruct { @@ -277,7 +277,7 @@ typedef struct filestruct { /* Next node. */ struct filestruct *prev; /* Previous node. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR short *multidata; /* Array of which multi-line regexes apply to this line. */ #endif @@ -401,7 +401,7 @@ typedef struct openfilestruct { char *lock_filename; /* The path of the lockfile, if we created one. */ #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR syntaxtype *syntax; /* The syntax struct for this file, if any. */ colortype *colorstrings; diff --git a/src/proto.h b/src/proto.h index e72e6630..dfc8f228 100644 --- a/src/proto.h +++ b/src/proto.h @@ -43,7 +43,7 @@ extern bool as_an_at; extern int margin; extern int editwincols; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR extern bool have_palette; #endif @@ -145,7 +145,7 @@ extern char *operating_dir; extern char *alt_speller; #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR extern syntaxtype *syntaxes; extern char *syntaxstr; #endif @@ -175,7 +175,7 @@ extern regex_t search_regexp; extern regmatch_t regmatches[10]; extern int hilite_attribute; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR extern char* specified_color_combo[NUMBER_OF_ELEMENTS]; #endif extern int interface_color_pair[NUMBER_OF_ELEMENTS]; @@ -245,7 +245,7 @@ bool is_valid_mbstring(const char *s); #endif /* Most functions in color.c. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR void set_colorpairs(void); void color_init(void); void color_update(void); @@ -330,7 +330,7 @@ int keycode_from_string(const char *keystring); void assign_keyinfo(sc *s, const char *keystring, const int keycode); void print_sclist(void); void shortcut_init(void); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR void set_lint_or_format_shortcuts(void); void set_spell_shortcuts(void); #endif @@ -483,7 +483,7 @@ int do_yesno_prompt(bool all, const char *msg); /* Most functions in rcfile.c. */ #ifdef ENABLE_NANORC -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); void grab_and_store(const char *kind, char *ptr, regexlisttype **storage); #endif @@ -568,7 +568,7 @@ void do_full_justify(void); #ifdef ENABLE_SPELLER void do_spell(void); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR void do_linter(void); void do_formatter(void); #endif diff --git a/src/rcfile.c b/src/rcfile.c index e7b21e1a..bbc0a542 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -111,7 +111,7 @@ static const rcoption rcopts[] = { {"wordbounds", WORD_BOUNDS}, {"wordchars", 0}, #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR {"titlecolor", 0}, {"numbercolor", 0}, {"selectedcolor", 0}, @@ -128,7 +128,7 @@ static size_t lineno = 0; /* If we did, the line number where the last error occurred. */ static char *nanorc = NULL; /* The path to the rcfile we're parsing. */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR static bool opensyntax = FALSE; /* Whether we're allowed to add to the last syntax. When a file ends, * or when a new syntax command is seen, this bool becomes FALSE. */ @@ -221,7 +221,7 @@ char *parse_argument(char *ptr) return ptr; } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* Pass over the current regex string in the line starting at ptr, * null-terminate it, and return a pointer to the /next/ word. */ char *parse_next_regex(char *ptr) @@ -344,7 +344,7 @@ void parse_syntax(char *ptr) if (*ptr != '\0') grab_and_store("extension", ptr, &live_syntax->extensions); } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ /* Check whether the given executable function is "universal" (meaning * any horizontal movement or deletion) and thus is present in almost @@ -526,7 +526,7 @@ bool is_good_file(char *file) return TRUE; } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* Read and parse one included syntax file. */ static void parse_one_include(char *file) { @@ -873,7 +873,7 @@ void pick_up_name(const char *kind, char *ptr, char **storage) *storage = mallocstrcpy(*storage, ptr); } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ /* Verify that the user has not unmapped every shortcut for a * function that we consider 'vital' (such as "Exit"). */ @@ -934,7 +934,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) keyword = ptr; ptr = parse_next_word(ptr); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* Handle extending first... */ if (strcasecmp(keyword, "extendsyntax") == 0) { syntaxtype *sint; @@ -1005,7 +1005,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) else if (strcasecmp(keyword, "include") == 0) parse_includes(ptr); else -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ if (strcasecmp(keyword, "set") == 0) set = 1; else if (strcasecmp(keyword, "unset") == 0) @@ -1017,7 +1017,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) else rcfile_error(N_("Command \"%s\" not understood"), keyword); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* If a syntax was extended, it stops at the end of the command. */ if (live_syntax != syntaxes) opensyntax = FALSE; @@ -1086,7 +1086,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) continue; } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (strcasecmp(rcopts[i].name, "titlecolor") == 0) specified_color_combo[TITLE_BAR] = option; else if (strcasecmp(rcopts[i].name, "numbercolor") == 0) @@ -1181,7 +1181,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) assert(FALSE); } -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (opensyntax && lastcolor == NULL) rcfile_error(N_("Syntax \"%s\" has no color commands"), live_syntax->name); diff --git a/src/search.c b/src/search.c index 183a1ed0..a63885f4 100644 --- a/src/search.c +++ b/src/search.c @@ -683,7 +683,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, openfile->current->data = copy; if (!replaceall) { -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* When doing syntax coloring, the replacement might require * a change of colors, so refresh the whole edit window. */ if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) @@ -701,7 +701,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, if (numreplaced == -1) not_found_msg(needle); -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR else if (numreplaced > 0) refresh_needed = TRUE; #endif diff --git a/src/text.c b/src/text.c index 95392d21..37b52e4a 100644 --- a/src/text.c +++ b/src/text.c @@ -73,7 +73,7 @@ void do_mark(void) } #endif /* !NANO_TINY */ -#if !defined(DISABLE_COLOR) || defined(ENABLE_SPELLER) +#if defined(ENABLE_COLOR) || defined(ENABLE_SPELLER) /* Return an error message containing the given name. */ char *invocation_error(const char *name) { @@ -501,7 +501,7 @@ void do_comment(void) size_t top_x, bot_x; bool empty, all_empty = TRUE; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (openfile->syntax) comment_seq = openfile->syntax->comment; @@ -3051,7 +3051,7 @@ void do_spell(void) } #endif /* ENABLE_SPELLER */ -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* Run a linting program on the current buffer. Return NULL for normal * termination, and the error string otherwise. */ void do_linter(void) @@ -3498,7 +3498,7 @@ void do_formatter(void) total_refresh(); } #endif /* ENABLE_SPELLER */ -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ #ifndef NANO_TINY /* Our own version of "wc". Note that its character counts are in diff --git a/src/winio.c b/src/winio.c index 54599452..d4facab4 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2413,7 +2413,7 @@ void place_the_cursor(void) void edit_draw(filestruct *fileptr, const char *converted, int row, size_t from_col) { -#if !defined(NANO_TINY) || !defined(DISABLE_COLOR) +#if !defined(NANO_TINY) || defined(ENABLE_COLOR) size_t from_x = actual_x(fileptr->data, from_col); /* The position in fileptr->data of the leftmost character * that displays at least partially on the window. */ @@ -2450,7 +2450,7 @@ void edit_draw(filestruct *fileptr, const char *converted, wredrawln(edit, row, 1); #endif -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* If color syntaxes are available and turned on, apply them. */ if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { const colortype *varnish = openfile->colorstrings; @@ -2698,7 +2698,7 @@ void edit_draw(filestruct *fileptr, const char *converted, wattroff(edit, varnish->attributes); } } -#endif /* !DISABLE_COLOR */ +#endif /* ENABLE_COLOR */ #ifndef NANO_TINY /* If the mark is on, and fileptr is at least partially selected, we @@ -3298,7 +3298,7 @@ void edit_refresh(void) filestruct *line; int row = 0; -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR /* When needed, initialize the colors for the current syntax. */ if (!have_palette) color_init(); @@ -3387,7 +3387,7 @@ void total_refresh(void) * portion of the window. */ void display_main_list(void) { -#ifndef DISABLE_COLOR +#ifdef ENABLE_COLOR if (openfile->syntax && (openfile->syntax->formatter || openfile->syntax->linter)) set_lint_or_format_shortcuts();