Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
0b30835d
Commit
0b30835d
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: use meaningful names instead of puzzling values
Suggested-by:
Brand Huntsman
<
alpha@qzx.com
>
parent
a865c25e
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/color.c
+4
-4
src/color.c
src/nano.h
+5
-0
src/nano.h
src/rcfile.c
+6
-6
src/rcfile.c
with
15 additions
and
10 deletions
+15
-10
src/color.c
View file @
0b30835d
...
@@ -60,9 +60,9 @@ void set_colorpairs(void)
...
@@ -60,9 +60,9 @@ void set_colorpairs(void)
colortype
*
combo
=
color_combo
[
i
];
colortype
*
combo
=
color_combo
[
i
];
if
(
combo
!=
NULL
)
{
if
(
combo
!=
NULL
)
{
if
(
combo
->
fg
==
-
1
&&
!
using_defaults
)
if
(
combo
->
fg
==
USE_THE_DEFAULT
&&
!
using_defaults
)
combo
->
fg
=
COLOR_WHITE
;
combo
->
fg
=
COLOR_WHITE
;
if
(
combo
->
bg
==
-
1
&&
!
using_defaults
)
if
(
combo
->
bg
==
USE_THE_DEFAULT
&&
!
using_defaults
)
combo
->
bg
=
COLOR_BLACK
;
combo
->
bg
=
COLOR_BLACK
;
init_pair
(
i
+
1
,
combo
->
fg
,
combo
->
bg
);
init_pair
(
i
+
1
,
combo
->
fg
,
combo
->
bg
);
interface_color_pair
[
i
]
=
COLOR_PAIR
(
i
+
1
)
|
A_BANDAID
|
interface_color_pair
[
i
]
=
COLOR_PAIR
(
i
+
1
)
|
A_BANDAID
|
...
@@ -125,10 +125,10 @@ void color_init(void)
...
@@ -125,10 +125,10 @@ void color_init(void)
foreground
=
ink
->
fg
;
foreground
=
ink
->
fg
;
background
=
ink
->
bg
;
background
=
ink
->
bg
;
if
(
foreground
==
-
1
&&
!
using_defaults
)
if
(
foreground
==
USE_THE_DEFAULT
&&
!
using_defaults
)
foreground
=
COLOR_WHITE
;
foreground
=
COLOR_WHITE
;
if
(
background
==
-
1
&&
!
using_defaults
)
if
(
background
==
USE_THE_DEFAULT
&&
!
using_defaults
)
background
=
COLOR_BLACK
;
background
=
COLOR_BLACK
;
init_pair
(
ink
->
pairnum
,
foreground
,
background
);
init_pair
(
ink
->
pairnum
,
foreground
,
background
);
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
0b30835d
...
@@ -142,6 +142,11 @@
...
@@ -142,6 +142,11 @@
#define REPLACING 1
#define REPLACING 1
#define INREGION 2
#define INREGION 2
#ifdef ENABLE_COLOR
#define USE_THE_DEFAULT -1
#define BAD_COLOR -2
#endif
/* Enumeration types. */
/* Enumeration types. */
typedef
enum
{
typedef
enum
{
NIX_FILE
,
DOS_FILE
,
MAC_FILE
NIX_FILE
,
DOS_FILE
,
MAC_FILE
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
0b30835d
...
@@ -603,10 +603,10 @@ short color_to_short(const char *colorname, bool *bright)
...
@@ -603,10 +603,10 @@ short color_to_short(const char *colorname, bool *bright)
else
if
(
strcasecmp
(
colorname
,
"black"
)
==
0
)
else
if
(
strcasecmp
(
colorname
,
"black"
)
==
0
)
return
COLOR_BLACK
;
return
COLOR_BLACK
;
else
if
(
strcasecmp
(
colorname
,
"normal"
)
==
0
)
else
if
(
strcasecmp
(
colorname
,
"normal"
)
==
0
)
return
-
1
;
return
USE_THE_DEFAULT
;
rcfile_error
(
N_
(
"Color
\"
%s
\"
not understood"
),
colorname
);
rcfile_error
(
N_
(
"Color
\"
%s
\"
not understood"
),
colorname
);
return
-
2
;
return
BAD_COLOR
;
}
}
/* Parse the color name (or pair of color names) in the given string.
/* Parse the color name (or pair of color names) in the given string.
...
@@ -621,18 +621,18 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
...
@@ -621,18 +621,18 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
rcfile_error
(
N_
(
"A background color cannot be bright"
));
rcfile_error
(
N_
(
"A background color cannot be bright"
));
return
FALSE
;
return
FALSE
;
}
}
if
(
*
bg
==
-
2
)
if
(
*
bg
==
BAD_COLOR
)
return
FALSE
;
return
FALSE
;
*
comma
=
'\0'
;
*
comma
=
'\0'
;
}
else
}
else
*
bg
=
-
1
;
*
bg
=
USE_THE_DEFAULT
;
if
(
comma
!=
combostr
)
{
if
(
comma
!=
combostr
)
{
*
fg
=
color_to_short
(
combostr
,
bright
);
*
fg
=
color_to_short
(
combostr
,
bright
);
if
(
*
fg
==
-
2
)
if
(
*
fg
==
BAD_COLOR
)
return
FALSE
;
return
FALSE
;
}
else
}
else
*
fg
=
-
1
;
*
fg
=
USE_THE_DEFAULT
;
return
TRUE
;
return
TRUE
;
}
}
...
...
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
Menu
Projects
Groups
Snippets
Help