in parse_colors(), properly parse a background color without a
foreground color git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2618 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
746214d5aa
Коммит
7c78b45e76
@ -136,6 +136,10 @@ CVS code -
|
||||
(DLR)
|
||||
- Don't set current_len until after it's been asserted that both
|
||||
current and current->data aren't NULL. (DLR)
|
||||
- rcfile.c:
|
||||
parse_colors()
|
||||
- Properly parse a background color without a foreground color.
|
||||
(DLR)
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Properly show an error message if we try to go to line 0,
|
||||
@ -197,6 +201,10 @@ CVS code -
|
||||
- doc/faq.html:
|
||||
- Update the question about the FAQ to mention the current
|
||||
maintainer. (DLR)
|
||||
- doc/nanorc.sample:
|
||||
- In the "nanorc" regexes, tweak the "color" regex to properly
|
||||
color a line that specifies a background color without a
|
||||
foreground color, and update the associated comments. (DLR)
|
||||
- doc/man/fr/Makefile.am:
|
||||
- Set mandir to @mandir@/fr, so French manpages get installed
|
||||
where they belong (Jordi).
|
||||
|
@ -133,9 +133,10 @@
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
## Not specifying a foreground color will use the default foreground
|
||||
## color. If your system supports transparency, not specifying a
|
||||
## background color will use a transparent color. If you don't want the
|
||||
## latter, be sure to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|h|H|hh|hpp)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
@ -264,7 +265,7 @@
|
||||
# color cyan "^ *(set|unset) +(view|whitespace)"
|
||||
# color green "^ *(set|unset|syntax)\>"
|
||||
## colors
|
||||
# color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# color yellow "^ *color *(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
# color magenta "^ *color\>" "\<(start|end)="
|
||||
## strings
|
||||
# color white "\"(\\.|[^\"])*\""
|
||||
|
20
src/rcfile.c
20
src/rcfile.c
@ -353,7 +353,7 @@ void parse_syntax(char *ptr)
|
||||
void parse_colors(char *ptr)
|
||||
{
|
||||
int fg, bg;
|
||||
bool bright = FALSE;
|
||||
bool bright = FALSE, no_fgcolor = FALSE;
|
||||
char *fgstr;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@ -368,8 +368,15 @@ void parse_colors(char *ptr)
|
||||
|
||||
if (strchr(fgstr, ',') != NULL) {
|
||||
char *bgcolorname;
|
||||
|
||||
strtok(fgstr, ",");
|
||||
bgcolorname = strtok(NULL, ",");
|
||||
if (bgcolorname == NULL) {
|
||||
/* If we have a background color without a foreground color,
|
||||
* parse it properly. */
|
||||
bgcolorname = fgstr + 1;
|
||||
no_fgcolor = TRUE;
|
||||
}
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(
|
||||
N_("Background color %s cannot be bright"),
|
||||
@ -380,11 +387,14 @@ void parse_colors(char *ptr)
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
if (!no_fgcolor) {
|
||||
fg = color_to_int(fgstr, &bright);
|
||||
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
/* Don't try to parse screwed-up foreground colors. */
|
||||
if (fg == -1)
|
||||
return;
|
||||
} else
|
||||
fg = -1;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user