Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
d5ac1ed3
Commit
d5ac1ed3
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR
parent
2a4fc959
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
configure.ac
+11
-11
configure.ac
src/color.c
+2
-2
src/color.c
src/cut.c
+2
-2
src/cut.c
src/files.c
+5
-5
src/files.c
src/global.c
+18
-18
src/global.c
src/help.c
+3
-3
src/help.c
src/nano.c
+12
-12
src/nano.c
src/nano.h
+4
-4
src/nano.h
src/proto.h
+7
-7
src/proto.h
src/rcfile.c
+11
-11
src/rcfile.c
src/search.c
+2
-2
src/search.c
src/text.c
+4
-4
src/text.c
src/winio.c
+5
-5
src/winio.c
with
86 additions
and
86 deletions
+86
-86
configure.ac
View file @
d5ac1ed3
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
src/color.c
View file @
d5ac1ed3
...
...
@@ -28,7 +28,7 @@
#include <string.h>
#include <unistd.h>
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_COLOR */
This diff is collapsed.
Click to expand it.
src/cut.c
View file @
d5ac1ed3
...
...
@@ -188,7 +188,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
refresh_needed
=
TRUE
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
check_the_multis
(
openfile
->
current
);
#endif
...
...
@@ -289,7 +289,7 @@ void do_uncut_text(void)
refresh_needed
=
TRUE
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
check_the_multis
(
openfile
->
current
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
d5ac1ed3
...
...
@@ -107,7 +107,7 @@ void make_new_buffer(void)
openfile
->
current_stat
=
NULL
;
openfile
->
lock_filename
=
NULL
;
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
openfile
->
syntax
=
NULL
;
openfile
->
colorstrings
=
NULL
;
#endif
...
...
@@ -496,7 +496,7 @@ bool open_buffer(const char *filename, bool undoable)
openfile
->
placewewant
=
0
;
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
)
{
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
const
char
*
oldname
,
*
newname
;
oldname
=
openfile
->
syntax
?
openfile
->
syntax
->
name
:
""
;
#endif
openfile
->
filename
=
mallocstrcpy
(
openfile
->
filename
,
realname
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
/* See if the applicable syntax has changed. */
color_update
();
color_init
();
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
d5ac1ed3
...
...
@@ -51,7 +51,7 @@ int margin = 0;
int
editwincols
=
-
1
;
/* The number of usable columns in the edit window: COLS - margin. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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(
DIS
ABLE_COLOR)) || \
!defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && defined(
DIS
ABLE_COLOR))
#if (defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(
EN
ABLE_COLOR)) || \
!defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) &&
!
defined(
EN
ABLE_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(
DIS
ABLE_COLOR)) || \
defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && defined(
DIS
ABLE_COLOR))
#if (!defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(
EN
ABLE_COLOR)) || \
defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) &&
!
defined(
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
add_to_sclist
(
MMAIN
,
"M-Y"
,
0
,
do_toggle_void
,
NO_COLOR_SYNTAX
);
#endif
...
...
@@ -1362,7 +1362,7 @@ void shortcut_init(void)
#endif
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_COLOR */
const
subnfunc
*
sctofunc
(
const
sc
*
s
)
{
...
...
@@ -1507,7 +1507,7 @@ sc *strtosc(const char *input)
!
strcasecmp
(
input
,
"speller"
))
s
->
scfunc
=
do_spell
;
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
free
(
syntaxstr
);
while
(
syntaxes
!=
NULL
)
{
syntaxtype
*
sint
=
syntaxes
;
...
...
@@ -1848,7 +1848,7 @@ void thanks_for_all_the_fish(void)
free
(
sint
);
}
#endif
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_COLOR */
#ifdef ENABLE_HISTORIES
/* Free the search, replace, and execute history lists. */
free_filestruct
(
searchtop
);
...
...
This diff is collapsed.
Click to expand it.
src/help.c
View file @
d5ac1ed3
...
...
@@ -103,7 +103,7 @@ void do_help(void)
int
was_margin
=
margin
;
#endif
ssize_t
was_tabsize
=
tabsize
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
syntaxstr
=
"nanohelp"
;
#endif
curs_set
(
0
);
...
...
@@ -251,7 +251,7 @@ void do_help(void)
margin
=
was_margin
;
#endif
tabsize
=
was_tabsize
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
syntaxstr
=
was_syntax
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
d5ac1ed3
...
...
@@ -71,7 +71,7 @@ filestruct *make_new_node(filestruct *prevnode)
newnode
->
next
=
NULL
;
newnode
->
lineno
=
(
prevnode
!=
NULL
)
?
prevnode
->
lineno
+
1
:
1
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
newnode
->
multidata
=
NULL
;
#endif
...
...
@@ -88,7 +88,7 @@ filestruct *copy_node(const filestruct *src)
dst
->
prev
=
src
->
prev
;
dst
->
lineno
=
src
->
lineno
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
dst
->
multidata
=
NULL
;
#endif
...
...
@@ -128,7 +128,7 @@ void unlink_node(filestruct *fileptr)
void
delete_node
(
filestruct
*
fileptr
)
{
free
(
fileptr
->
data
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
free
(
fileptr
->
multidata
);
#endif
free
(
fileptr
);
...
...
@@ -848,7 +848,7 @@ void usage(void)
print_opt
(
_
(
"-X <str>"
),
_
(
"--wordchars=<str>"
),
N_
(
"Which other characters are word parts"
));
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
if
(
!
ISSET
(
RESTRICTED
))
print_opt
(
_
(
"-Y <name>"
),
_
(
"--syntax=<name>"
),
N_
(
"Syntax definition to use for coloring"
));
...
...
@@ -930,7 +930,7 @@ void version(void)
#ifdef ENABLE_BROWSER
printf
(
" --enable-browser"
);
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
printf
(
" --enable-color"
);
#endif
#ifndef DISABLE_EXTRA
...
...
@@ -976,7 +976,7 @@ void version(void)
#ifndef ENABLE_BROWSER
printf
(
" --disable-browser"
);
#endif
#ifdef
DIS
ABLE_COLOR
#if
n
def
EN
ABLE_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. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
case
NO_COLOR_SYNTAX
:
#endif
refresh_needed
=
TRUE
;
...
...
@@ -1714,7 +1714,7 @@ int do_input(bool allow_funcs)
refresh_needed
=
TRUE
;
}
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
();
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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'
},
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
case
'Y'
:
syntaxstr
=
mallocstrcpy
(
syntaxstr
,
optarg
);
break
;
...
...
@@ -2491,7 +2491,7 @@ int main(int argc, char **argv)
mouse_init
();
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
set_colorpairs
();
#else
interface_color_pair
[
TITLE_BAR
]
=
hilite_attribute
;
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
d5ac1ed3
...
...
@@ -176,7 +176,7 @@ typedef enum {
}
undo_type
;
/* Structure types. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_COLOR */
/* More structure types. */
typedef
struct
filestruct
{
...
...
@@ -277,7 +277,7 @@ typedef struct filestruct {
/* Next node. */
struct
filestruct
*
prev
;
/* Previous node. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
syntaxtype
*
syntax
;
/* The syntax struct for this file, if any. */
colortype
*
colorstrings
;
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
d5ac1ed3
...
...
@@ -43,7 +43,7 @@ extern bool as_an_at;
extern
int
margin
;
extern
int
editwincols
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
extern
bool
have_palette
;
#endif
...
...
@@ -145,7 +145,7 @@ extern char *operating_dir;
extern
char
*
alt_speller
;
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
void
do_linter
(
void
);
void
do_formatter
(
void
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
d5ac1ed3
...
...
@@ -111,7 +111,7 @@ static const rcoption rcopts[] = {
{
"wordbounds"
,
WORD_BOUNDS
},
{
"wordchars"
,
0
},
#endif
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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. */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
;
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_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
;
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
;
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
}
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
if
(
opensyntax
&&
lastcolor
==
NULL
)
rcfile_error
(
N_
(
"Syntax
\"
%s
\"
has no color commands"
),
live_syntax
->
name
);
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
d5ac1ed3
...
...
@@ -683,7 +683,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
openfile
->
current
->
data
=
copy
;
if
(
!
replaceall
)
{
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
);
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
else
if
(
numreplaced
>
0
)
refresh_needed
=
TRUE
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
d5ac1ed3
...
...
@@ -73,7 +73,7 @@ void do_mark(void)
}
#endif
/* !NANO_TINY */
#if
!
defined(
DIS
ABLE_COLOR) || defined(ENABLE_SPELLER)
#if defined(
EN
ABLE_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
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
if
(
openfile
->
syntax
)
comment_seq
=
openfile
->
syntax
->
comment
;
...
...
@@ -3051,7 +3051,7 @@ void do_spell(void)
}
#endif
/* ENABLE_SPELLER */
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_COLOR */
#ifndef NANO_TINY
/* Our own version of "wc". Note that its character counts are in
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
d5ac1ed3
...
...
@@ -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(
DIS
ABLE_COLOR)
#if !defined(NANO_TINY) || defined(
EN
ABLE_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
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
/*
!DIS
ABLE_COLOR */
#endif
/*
EN
ABLE_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
;
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_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
)
{
#if
n
def
DIS
ABLE_COLOR
#ifdef
EN
ABLE_COLOR
if
(
openfile
->
syntax
&&
(
openfile
->
syntax
->
formatter
||
openfile
->
syntax
->
linter
))
set_lint_or_format_shortcuts
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment