tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR

This commit is contained in:
Benno Schulenberg 2017-11-01 19:45:33 +01:00
parent 2a4fc9591f
commit d5ac1ed395
13 changed files with 86 additions and 86 deletions

View File

@ -75,6 +75,15 @@ fi
AC_ARG_ENABLE(color, AC_ARG_ENABLE(color,
AS_HELP_STRING([--disable-color], [Disable color and syntax highlighting])) 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_nanorc" = xno; then
if test "x$enable_color" = xyes; then if test "x$enable_color" = xyes; then
AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc]) AC_MSG_ERROR([--enable-color cannot work with --disable-nanorc])
@ -83,9 +92,8 @@ if test "x$enable_nanorc" = xno; then
enable_color=no enable_color=no
fi fi
fi fi
if test "x$enable_color" = xno; then if test "x$enable_color" != xno; then
AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.]) AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting.])
else
color_support=yes color_support=yes
fi fi
@ -276,14 +284,6 @@ AC_ARG_ENABLE(tiny,
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size])) AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
if test "x$enable_tiny" = xyes; then if test "x$enable_tiny" = xyes; then
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) 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 if test "x$enable_extra" != xyes; then
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.]) AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
fi fi

View File

@ -28,7 +28,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* Initialize the colors for nano's interface, and assign pair numbers /* Initialize the colors for nano's interface, and assign pair numbers
* for the colors in each syntax. */ * for the colors in each syntax. */
@ -424,4 +424,4 @@ void precalc_multicolorinfo(void)
} }
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */

View File

@ -188,7 +188,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
refresh_needed = TRUE; refresh_needed = TRUE;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
check_the_multis(openfile->current); check_the_multis(openfile->current);
#endif #endif
@ -289,7 +289,7 @@ void do_uncut_text(void)
refresh_needed = TRUE; refresh_needed = TRUE;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
check_the_multis(openfile->current); check_the_multis(openfile->current);
#endif #endif

View File

@ -107,7 +107,7 @@ void make_new_buffer(void)
openfile->current_stat = NULL; openfile->current_stat = NULL;
openfile->lock_filename = NULL; openfile->lock_filename = NULL;
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
openfile->syntax = NULL; openfile->syntax = NULL;
openfile->colorstrings = NULL; openfile->colorstrings = NULL;
#endif #endif
@ -496,7 +496,7 @@ bool open_buffer(const char *filename, bool undoable)
openfile->placewewant = 0; openfile->placewewant = 0;
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* If we're loading into a new buffer, update the colors to account /* If we're loading into a new buffer, update the colors to account
* for it, if applicable. */ * for it, if applicable. */
if (new_buffer) if (new_buffer)
@ -573,7 +573,7 @@ void prepare_for_display(void)
if (!inhelp) if (!inhelp)
titlebar(NULL); titlebar(NULL);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* If there are multiline coloring regexes, and there is no /* If there are multiline coloring regexes, and there is no
* multiline cache data yet, precalculate it now. */ * multiline cache data yet, precalculate it now. */
if (openfile->syntax && openfile->syntax->nmultis > 0 && 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 (method == OVERWRITE && !tmp) {
/* If we must set the filename, and it changed, adjust things. */ /* If we must set the filename, and it changed, adjust things. */
if (!nonamechange && strcmp(openfile->filename, realname) != 0) { if (!nonamechange && strcmp(openfile->filename, realname) != 0) {
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
const char *oldname, *newname; const char *oldname, *newname;
oldname = openfile->syntax ? openfile->syntax->name : ""; oldname = openfile->syntax ? openfile->syntax->name : "";
#endif #endif
openfile->filename = mallocstrcpy(openfile->filename, realname); openfile->filename = mallocstrcpy(openfile->filename, realname);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* See if the applicable syntax has changed. */ /* See if the applicable syntax has changed. */
color_update(); color_update();
color_init(); color_init();

View File

@ -51,7 +51,7 @@ int margin = 0;
int editwincols = -1; int editwincols = -1;
/* The number of usable columns in the edit window: COLS - margin. */ /* The number of usable columns in the edit window: COLS - margin. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
bool have_palette = FALSE; bool have_palette = FALSE;
/* Whether the colors for the current syntax have been initialized. */ /* Whether the colors for the current syntax have been initialized. */
#endif #endif
@ -179,7 +179,7 @@ char *alt_speller = NULL;
/* The command to use for the alternate spell checker. */ /* The command to use for the alternate spell checker. */
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
syntaxtype *syntaxes = NULL; syntaxtype *syntaxes = NULL;
/* The global list of color syntaxes. */ /* The global list of color syntaxes. */
char *syntaxstr = NULL; char *syntaxstr = NULL;
@ -233,7 +233,7 @@ regmatch_t regmatches[10];
int hilite_attribute = A_REVERSE; int hilite_attribute = A_REVERSE;
/* The curses attribute we use to highlight something. */ /* The curses attribute we use to highlight something. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
char* specified_color_combo[] = {NULL}; char* specified_color_combo[] = {NULL};
/* The color combinations as specified in the rcfile. */ /* The color combinations as specified in the rcfile. */
#endif #endif
@ -670,7 +670,7 @@ void shortcut_init(void)
const char *forwardfile_gist = N_("Go to the next file in the list"); const char *forwardfile_gist = N_("Go to the next file in the list");
const char *gotodir_gist = N_("Go to directory"); const char *gotodir_gist = N_("Go to directory");
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
const char *lint_gist = N_("Invoke the linter, if available"); const char *lint_gist = N_("Invoke the linter, if available");
const char *prevlint_gist = N_("Go to previous linter msg"); const char *prevlint_gist = N_("Go to previous linter msg");
const char *nextlint_gist = N_("Go to next 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, add_to_funcs(do_spell, MMAIN,
N_("To Spell"), WITHORSANS(spell_gist), TOGETHER, NOVIEW); N_("To Spell"), WITHORSANS(spell_gist), TOGETHER, NOVIEW);
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
add_to_funcs(do_linter, MMAIN, add_to_funcs(do_linter, MMAIN,
N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW); N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
@ -792,8 +792,8 @@ void shortcut_init(void)
add_to_funcs(do_cursorpos_void, MMAIN, add_to_funcs(do_cursorpos_void, MMAIN,
N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW); N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
#if (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(DISABLE_COLOR)) !defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_COLOR))
/* Conditionally placing this one here or further on, to keep the /* Conditionally placing this one here or further on, to keep the
* help items nicely paired in most conditions. */ * help items nicely paired in most conditions. */
add_to_funcs(do_gotolinecolumn_void, MMAIN, add_to_funcs(do_gotolinecolumn_void, MMAIN,
@ -906,8 +906,8 @@ void shortcut_init(void)
N_("Next File"), WITHORSANS(nextfile_gist), BLANKAFTER, VIEW); N_("Next File"), WITHORSANS(nextfile_gist), BLANKAFTER, VIEW);
#endif #endif
#if (!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(DISABLE_COLOR)) defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_COLOR))
add_to_funcs(do_gotolinecolumn_void, MMAIN, add_to_funcs(do_gotolinecolumn_void, MMAIN,
gotoline_tag, WITHORSANS(gotoline_gist), BLANKAFTER, VIEW); gotoline_tag, WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
#endif #endif
@ -1072,7 +1072,7 @@ void shortcut_init(void)
add_to_funcs(discard_buffer, MWRITEFILE, add_to_funcs(discard_buffer, MWRITEFILE,
N_("Discard buffer"), WITHORSANS(discardbuffer_gist), BLANKAFTER, NOVIEW); N_("Discard buffer"), WITHORSANS(discardbuffer_gist), BLANKAFTER, NOVIEW);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
add_to_funcs(do_page_up, MLINTER, add_to_funcs(do_page_up, MLINTER,
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */ /* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
N_("Prev Lint Msg"), WITHORSANS(prevlint_gist), TOGETHER, VIEW); 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, "^T", 0, do_spell, 0);
add_to_sclist(MMAIN, "F12", 0, do_spell, 0); add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
#else #else
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
add_to_sclist(MMAIN, "^T", 0, do_linter, 0); add_to_sclist(MMAIN, "^T", 0, do_linter, 0);
add_to_sclist(MMAIN, "F12", 0, do_linter, 0); add_to_sclist(MMAIN, "F12", 0, do_linter, 0);
#endif #endif
@ -1244,7 +1244,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS); add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
#endif #endif
add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY); 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); add_to_sclist(MMAIN, "M-Y", 0, do_toggle_void, NO_COLOR_SYNTAX);
#endif #endif
@ -1362,7 +1362,7 @@ void shortcut_init(void)
#endif #endif
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
void set_lint_or_format_shortcuts(void) void set_lint_or_format_shortcuts(void)
{ {
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
@ -1383,7 +1383,7 @@ void set_spell_shortcuts(void)
replace_scs_for(do_linter, do_spell); replace_scs_for(do_linter, do_spell);
#endif #endif
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
const subnfunc *sctofunc(const sc *s) const subnfunc *sctofunc(const sc *s)
{ {
@ -1507,7 +1507,7 @@ sc *strtosc(const char *input)
!strcasecmp(input, "speller")) !strcasecmp(input, "speller"))
s->scfunc = do_spell; s->scfunc = do_spell;
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
else if (!strcasecmp(input, "linter")) else if (!strcasecmp(input, "linter"))
s->scfunc = do_linter; s->scfunc = do_linter;
#endif #endif
@ -1677,7 +1677,7 @@ sc *strtosc(const char *input)
s->toggle = SOFTWRAP; s->toggle = SOFTWRAP;
else if (!strcasecmp(input, "whitespacedisplay")) else if (!strcasecmp(input, "whitespacedisplay"))
s->toggle = WHITESPACE_DISPLAY; s->toggle = WHITESPACE_DISPLAY;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
else if (!strcasecmp(input, "nosyntax")) else if (!strcasecmp(input, "nosyntax"))
s->toggle = NO_COLOR_SYNTAX; s->toggle = NO_COLOR_SYNTAX;
#endif #endif
@ -1801,7 +1801,7 @@ void thanks_for_all_the_fish(void)
delete_opennode(openfile->prev); delete_opennode(openfile->prev);
} }
delete_opennode(openfile); delete_opennode(openfile);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
free(syntaxstr); free(syntaxstr);
while (syntaxes != NULL) { while (syntaxes != NULL) {
syntaxtype *sint = syntaxes; syntaxtype *sint = syntaxes;
@ -1848,7 +1848,7 @@ void thanks_for_all_the_fish(void)
free(sint); free(sint);
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
/* Free the search, replace, and execute history lists. */ /* Free the search, replace, and execute history lists. */
free_filestruct(searchtop); free_filestruct(searchtop);

View File

@ -103,7 +103,7 @@ void do_help(void)
int was_margin = margin; int was_margin = margin;
#endif #endif
ssize_t was_tabsize = tabsize; ssize_t was_tabsize = tabsize;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
char *was_syntax = syntaxstr; char *was_syntax = syntaxstr;
#endif #endif
char *saved_answer = (answer != NULL) ? strdup(answer) : NULL; char *saved_answer = (answer != NULL) ? strdup(answer) : NULL;
@ -149,7 +149,7 @@ void do_help(void)
margin = 0; margin = 0;
#endif #endif
tabsize = 8; tabsize = 8;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
syntaxstr = "nanohelp"; syntaxstr = "nanohelp";
#endif #endif
curs_set(0); curs_set(0);
@ -251,7 +251,7 @@ void do_help(void)
margin = was_margin; margin = was_margin;
#endif #endif
tabsize = was_tabsize; tabsize = was_tabsize;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
syntaxstr = was_syntax; syntaxstr = was_syntax;
#endif #endif

View File

@ -71,7 +71,7 @@ filestruct *make_new_node(filestruct *prevnode)
newnode->next = NULL; newnode->next = NULL;
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1; newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
newnode->multidata = NULL; newnode->multidata = NULL;
#endif #endif
@ -88,7 +88,7 @@ filestruct *copy_node(const filestruct *src)
dst->prev = src->prev; dst->prev = src->prev;
dst->lineno = src->lineno; dst->lineno = src->lineno;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
dst->multidata = NULL; dst->multidata = NULL;
#endif #endif
@ -128,7 +128,7 @@ void unlink_node(filestruct *fileptr)
void delete_node(filestruct *fileptr) void delete_node(filestruct *fileptr)
{ {
free(fileptr->data); free(fileptr->data);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
free(fileptr->multidata); free(fileptr->multidata);
#endif #endif
free(fileptr); free(fileptr);
@ -848,7 +848,7 @@ void usage(void)
print_opt(_("-X <str>"), _("--wordchars=<str>"), print_opt(_("-X <str>"), _("--wordchars=<str>"),
N_("Which other characters are word parts")); N_("Which other characters are word parts"));
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (!ISSET(RESTRICTED)) if (!ISSET(RESTRICTED))
print_opt(_("-Y <name>"), _("--syntax=<name>"), print_opt(_("-Y <name>"), _("--syntax=<name>"),
N_("Syntax definition to use for coloring")); N_("Syntax definition to use for coloring"));
@ -930,7 +930,7 @@ void version(void)
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
printf(" --enable-browser"); printf(" --enable-browser");
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
printf(" --enable-color"); printf(" --enable-color");
#endif #endif
#ifndef DISABLE_EXTRA #ifndef DISABLE_EXTRA
@ -976,7 +976,7 @@ void version(void)
#ifndef ENABLE_BROWSER #ifndef ENABLE_BROWSER
printf(" --disable-browser"); printf(" --disable-browser");
#endif #endif
#ifdef DISABLE_COLOR #ifndef ENABLE_COLOR
printf(" --disable-color"); printf(" --disable-color");
#endif #endif
#ifndef ENABLE_COMMENT #ifndef ENABLE_COMMENT
@ -1401,7 +1401,7 @@ void do_toggle(int flag)
break; break;
case WHITESPACE_DISPLAY: case WHITESPACE_DISPLAY:
titlebar(NULL); /* Fall through. */ titlebar(NULL); /* Fall through. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
case NO_COLOR_SYNTAX: case NO_COLOR_SYNTAX:
#endif #endif
refresh_needed = TRUE; refresh_needed = TRUE;
@ -1714,7 +1714,7 @@ int do_input(bool allow_funcs)
refresh_needed = TRUE; refresh_needed = TRUE;
} }
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (f && !f->viewok) if (f && !f->viewok)
check_the_multis(openfile->current); check_the_multis(openfile->current);
#endif #endif
@ -1882,7 +1882,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
check_the_multis(openfile->current); check_the_multis(openfile->current);
#endif #endif
@ -1924,7 +1924,7 @@ int main(int argc, char **argv)
{"tabsize", 1, NULL, 'T'}, {"tabsize", 1, NULL, 'T'},
{"quickblank", 0, NULL, 'U'}, {"quickblank", 0, NULL, 'U'},
{"version", 0, NULL, 'V'}, {"version", 0, NULL, 'V'},
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
{"syntax", 1, NULL, 'Y'}, {"syntax", 1, NULL, 'Y'},
#endif #endif
{"constantshow", 0, NULL, 'c'}, {"constantshow", 0, NULL, 'c'},
@ -2122,7 +2122,7 @@ int main(int argc, char **argv)
word_chars = mallocstrcpy(word_chars, optarg); word_chars = mallocstrcpy(word_chars, optarg);
break; break;
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
case 'Y': case 'Y':
syntaxstr = mallocstrcpy(syntaxstr, optarg); syntaxstr = mallocstrcpy(syntaxstr, optarg);
break; break;
@ -2491,7 +2491,7 @@ int main(int argc, char **argv)
mouse_init(); mouse_init();
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
set_colorpairs(); set_colorpairs();
#else #else
interface_color_pair[TITLE_BAR] = hilite_attribute; interface_color_pair[TITLE_BAR] = hilite_attribute;

View File

@ -176,7 +176,7 @@ typedef enum {
} undo_type; } undo_type;
/* Structure types. */ /* Structure types. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
typedef struct colortype { typedef struct colortype {
short fg; short fg;
/* This syntax's foreground color. */ /* This syntax's foreground color. */
@ -265,7 +265,7 @@ typedef struct lintstruct {
/* Regex starts and ends within this line. */ /* Regex starts and ends within this line. */
#define CWOULDBE (1<<6) #define CWOULDBE (1<<6)
/* An unpaired start match on or before this line. */ /* An unpaired start match on or before this line. */
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
/* More structure types. */ /* More structure types. */
typedef struct filestruct { typedef struct filestruct {
@ -277,7 +277,7 @@ typedef struct filestruct {
/* Next node. */ /* Next node. */
struct filestruct *prev; struct filestruct *prev;
/* Previous node. */ /* Previous node. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
short *multidata; short *multidata;
/* Array of which multi-line regexes apply to this line. */ /* Array of which multi-line regexes apply to this line. */
#endif #endif
@ -401,7 +401,7 @@ typedef struct openfilestruct {
char *lock_filename; char *lock_filename;
/* The path of the lockfile, if we created one. */ /* The path of the lockfile, if we created one. */
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
syntaxtype *syntax; syntaxtype *syntax;
/* The syntax struct for this file, if any. */ /* The syntax struct for this file, if any. */
colortype *colorstrings; colortype *colorstrings;

View File

@ -43,7 +43,7 @@ extern bool as_an_at;
extern int margin; extern int margin;
extern int editwincols; extern int editwincols;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
extern bool have_palette; extern bool have_palette;
#endif #endif
@ -145,7 +145,7 @@ extern char *operating_dir;
extern char *alt_speller; extern char *alt_speller;
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
extern syntaxtype *syntaxes; extern syntaxtype *syntaxes;
extern char *syntaxstr; extern char *syntaxstr;
#endif #endif
@ -175,7 +175,7 @@ extern regex_t search_regexp;
extern regmatch_t regmatches[10]; extern regmatch_t regmatches[10];
extern int hilite_attribute; extern int hilite_attribute;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS]; extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif #endif
extern int interface_color_pair[NUMBER_OF_ELEMENTS]; extern int interface_color_pair[NUMBER_OF_ELEMENTS];
@ -245,7 +245,7 @@ bool is_valid_mbstring(const char *s);
#endif #endif
/* Most functions in color.c. */ /* Most functions in color.c. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
void set_colorpairs(void); void set_colorpairs(void);
void color_init(void); void color_init(void);
void color_update(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 assign_keyinfo(sc *s, const char *keystring, const int keycode);
void print_sclist(void); void print_sclist(void);
void shortcut_init(void); void shortcut_init(void);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
void set_lint_or_format_shortcuts(void); void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void); void set_spell_shortcuts(void);
#endif #endif
@ -483,7 +483,7 @@ int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */ /* Most functions in rcfile.c. */
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage); void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
#endif #endif
@ -568,7 +568,7 @@ void do_full_justify(void);
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
void do_spell(void); void do_spell(void);
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
void do_linter(void); void do_linter(void);
void do_formatter(void); void do_formatter(void);
#endif #endif

View File

@ -111,7 +111,7 @@ static const rcoption rcopts[] = {
{"wordbounds", WORD_BOUNDS}, {"wordbounds", WORD_BOUNDS},
{"wordchars", 0}, {"wordchars", 0},
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
{"titlecolor", 0}, {"titlecolor", 0},
{"numbercolor", 0}, {"numbercolor", 0},
{"selectedcolor", 0}, {"selectedcolor", 0},
@ -128,7 +128,7 @@ static size_t lineno = 0;
/* If we did, the line number where the last error occurred. */ /* If we did, the line number where the last error occurred. */
static char *nanorc = NULL; static char *nanorc = NULL;
/* The path to the rcfile we're parsing. */ /* The path to the rcfile we're parsing. */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
static bool opensyntax = FALSE; static bool opensyntax = FALSE;
/* Whether we're allowed to add to the last syntax. When a file ends, /* 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. */ * or when a new syntax command is seen, this bool becomes FALSE. */
@ -221,7 +221,7 @@ char *parse_argument(char *ptr)
return ptr; return ptr;
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* Pass over the current regex string in the line starting at ptr, /* Pass over the current regex string in the line starting at ptr,
* null-terminate it, and return a pointer to the /next/ word. */ * null-terminate it, and return a pointer to the /next/ word. */
char *parse_next_regex(char *ptr) char *parse_next_regex(char *ptr)
@ -344,7 +344,7 @@ void parse_syntax(char *ptr)
if (*ptr != '\0') if (*ptr != '\0')
grab_and_store("extension", ptr, &live_syntax->extensions); grab_and_store("extension", ptr, &live_syntax->extensions);
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
/* Check whether the given executable function is "universal" (meaning /* Check whether the given executable function is "universal" (meaning
* any horizontal movement or deletion) and thus is present in almost * any horizontal movement or deletion) and thus is present in almost
@ -526,7 +526,7 @@ bool is_good_file(char *file)
return TRUE; return TRUE;
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* Read and parse one included syntax file. */ /* Read and parse one included syntax file. */
static void parse_one_include(char *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); *storage = mallocstrcpy(*storage, ptr);
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
/* Verify that the user has not unmapped every shortcut for a /* Verify that the user has not unmapped every shortcut for a
* function that we consider 'vital' (such as "Exit"). */ * function that we consider 'vital' (such as "Exit"). */
@ -934,7 +934,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
keyword = ptr; keyword = ptr;
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* Handle extending first... */ /* Handle extending first... */
if (strcasecmp(keyword, "extendsyntax") == 0) { if (strcasecmp(keyword, "extendsyntax") == 0) {
syntaxtype *sint; syntaxtype *sint;
@ -1005,7 +1005,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
else if (strcasecmp(keyword, "include") == 0) else if (strcasecmp(keyword, "include") == 0)
parse_includes(ptr); parse_includes(ptr);
else else
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
if (strcasecmp(keyword, "set") == 0) if (strcasecmp(keyword, "set") == 0)
set = 1; set = 1;
else if (strcasecmp(keyword, "unset") == 0) else if (strcasecmp(keyword, "unset") == 0)
@ -1017,7 +1017,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
else else
rcfile_error(N_("Command \"%s\" not understood"), keyword); 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 a syntax was extended, it stops at the end of the command. */
if (live_syntax != syntaxes) if (live_syntax != syntaxes)
opensyntax = FALSE; opensyntax = FALSE;
@ -1086,7 +1086,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
continue; continue;
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (strcasecmp(rcopts[i].name, "titlecolor") == 0) if (strcasecmp(rcopts[i].name, "titlecolor") == 0)
specified_color_combo[TITLE_BAR] = option; specified_color_combo[TITLE_BAR] = option;
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0) else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
@ -1181,7 +1181,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
assert(FALSE); assert(FALSE);
} }
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (opensyntax && lastcolor == NULL) if (opensyntax && lastcolor == NULL)
rcfile_error(N_("Syntax \"%s\" has no color commands"), rcfile_error(N_("Syntax \"%s\" has no color commands"),
live_syntax->name); live_syntax->name);

View File

@ -683,7 +683,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
openfile->current->data = copy; openfile->current->data = copy;
if (!replaceall) { if (!replaceall) {
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* When doing syntax coloring, the replacement might require /* When doing syntax coloring, the replacement might require
* a change of colors, so refresh the whole edit window. */ * a change of colors, so refresh the whole edit window. */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) 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) if (numreplaced == -1)
not_found_msg(needle); not_found_msg(needle);
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
else if (numreplaced > 0) else if (numreplaced > 0)
refresh_needed = TRUE; refresh_needed = TRUE;
#endif #endif

View File

@ -73,7 +73,7 @@ void do_mark(void)
} }
#endif /* !NANO_TINY */ #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. */ /* Return an error message containing the given name. */
char *invocation_error(const char *name) char *invocation_error(const char *name)
{ {
@ -501,7 +501,7 @@ void do_comment(void)
size_t top_x, bot_x; size_t top_x, bot_x;
bool empty, all_empty = TRUE; bool empty, all_empty = TRUE;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (openfile->syntax) if (openfile->syntax)
comment_seq = openfile->syntax->comment; comment_seq = openfile->syntax->comment;
@ -3051,7 +3051,7 @@ void do_spell(void)
} }
#endif /* ENABLE_SPELLER */ #endif /* ENABLE_SPELLER */
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* Run a linting program on the current buffer. Return NULL for normal /* Run a linting program on the current buffer. Return NULL for normal
* termination, and the error string otherwise. */ * termination, and the error string otherwise. */
void do_linter(void) void do_linter(void)
@ -3498,7 +3498,7 @@ void do_formatter(void)
total_refresh(); total_refresh();
} }
#endif /* ENABLE_SPELLER */ #endif /* ENABLE_SPELLER */
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
#ifndef NANO_TINY #ifndef NANO_TINY
/* Our own version of "wc". Note that its character counts are in /* Our own version of "wc". Note that its character counts are in

View File

@ -2413,7 +2413,7 @@ void place_the_cursor(void)
void edit_draw(filestruct *fileptr, const char *converted, void edit_draw(filestruct *fileptr, const char *converted,
int row, size_t from_col) 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); size_t from_x = actual_x(fileptr->data, from_col);
/* The position in fileptr->data of the leftmost character /* The position in fileptr->data of the leftmost character
* that displays at least partially on the window. */ * that displays at least partially on the window. */
@ -2450,7 +2450,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
wredrawln(edit, row, 1); wredrawln(edit, row, 1);
#endif #endif
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* If color syntaxes are available and turned on, apply them. */ /* If color syntaxes are available and turned on, apply them. */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *varnish = openfile->colorstrings; const colortype *varnish = openfile->colorstrings;
@ -2698,7 +2698,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
wattroff(edit, varnish->attributes); wattroff(edit, varnish->attributes);
} }
} }
#endif /* !DISABLE_COLOR */ #endif /* ENABLE_COLOR */
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the mark is on, and fileptr is at least partially selected, we /* If the mark is on, and fileptr is at least partially selected, we
@ -3298,7 +3298,7 @@ void edit_refresh(void)
filestruct *line; filestruct *line;
int row = 0; int row = 0;
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
/* When needed, initialize the colors for the current syntax. */ /* When needed, initialize the colors for the current syntax. */
if (!have_palette) if (!have_palette)
color_init(); color_init();
@ -3387,7 +3387,7 @@ void total_refresh(void)
* portion of the window. */ * portion of the window. */
void display_main_list(void) void display_main_list(void)
{ {
#ifndef DISABLE_COLOR #ifdef ENABLE_COLOR
if (openfile->syntax && if (openfile->syntax &&
(openfile->syntax->formatter || openfile->syntax->linter)) (openfile->syntax->formatter || openfile->syntax->linter))
set_lint_or_format_shortcuts(); set_lint_or_format_shortcuts();