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
9462ba82
Commit
9462ba82
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: simplify the parsing of color combinations
parent
23f5515f
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rcfile.c
+8
-19
src/rcfile.c
with
8 additions
and
19 deletions
+8
-19
src/rcfile.c
View file @
9462ba82
...
...
@@ -782,33 +782,22 @@ void parse_colors(char *ptr, int rex_flags)
/* Parse the color name, or pair of color names, in combostr. */
bool
parse_color_names
(
char
*
combostr
,
short
*
fg
,
short
*
bg
,
bool
*
bright
)
{
bool
no_fgcolor
=
FALSE
;
char
*
comma
=
strchr
(
combostr
,
','
)
;
if
(
combostr
==
NULL
)
return
FALSE
;
if
(
strchr
(
combostr
,
','
)
!=
NULL
)
{
char
*
bgcolorname
;
strtok
(
combostr
,
","
);
bgcolorname
=
strtok
(
NULL
,
","
);
if
(
bgcolorname
==
NULL
)
{
/* If we have a background color without a foreground color,
* parse it properly. */
bgcolorname
=
combostr
+
1
;
no_fgcolor
=
TRUE
;
}
if
(
strncasecmp
(
bgcolorname
,
"bright"
,
6
)
==
0
)
{
rcfile_error
(
N_
(
"Background color
\"
%s
\"
cannot be bright"
),
bgcolorname
);
if
(
comma
!=
NULL
)
{
*
comma
=
'\0'
;
if
(
strncasecmp
(
comma
+
1
,
"bright"
,
6
)
==
0
)
{
rcfile_error
(
N_
(
"A background color cannot be bright"
));
return
FALSE
;
}
*
bg
=
color_to_short
(
bgcolorname
,
bright
);
*
bg
=
color_to_short
(
comma
+
1
,
bright
);
}
else
*
bg
=
-
1
;
if
(
!
no_fgcolo
r
)
{
if
(
comma
!=
combost
r
)
{
*
fg
=
color_to_short
(
combostr
,
bright
);
/*
Don't try to parse screwed-up foreground color
s. */
/*
If the specified foreground color is bad, ignore the regexe
s. */
if
(
*
fg
==
-
1
)
return
FALSE
;
}
else
...
...
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