minor rcfile fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1540 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2003-09-06 05:09:32 +00:00
parent 74ea836fcc
commit 3bd9628b38
3 changed files with 37 additions and 23 deletions

View File

@ -61,6 +61,12 @@ CVS code -
support, pressing Ctrl-Z to suspend nano at the Linux console
with keypad(TRUE) generates Ctrl-Z instead of KEY_SUSPEND
(which is what ncurses generates then). (DLR)
- rcfile.c:
parse_colors()
- Generate an error if we try to use a bright background color
in a nanorc file. (DLR; found by Brand Huntsman)
- Make sure all rcfile error messages are capitalized, for
consistency. (DLR)
- winio.c:
titlebar()
- Fix problem with the available space for a filename on the
@ -82,6 +88,9 @@ CVS code -
- nanorc.sample:
- Remove duplicate "historylog" entry, remove "keypad" entry,
and add "rebinddelete" entry. (DLR)
- Update the regexes for nanorc files. (Brand Huntsman, slightly
modified by DLR)
- Fix one attempt at a bright background color. (DLR)
- AUTHORS
- Updated to show 1.2/1.3 maintainers.

View File

@ -193,16 +193,15 @@
# color blue "//.*"
# color blue start="/\*" end="\*/"
# color brightblue start="/\*\*" end="\*/"
# color brightgreen,brightgreen "[ ]+$"
# color green,brightgreen "[ ]+$"
## Here is an example for your .nanorc
##
# syntax "nanorc" "[\.]*nanorc$"
# color white "^ *(set|unset).*$"
# color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
# color brightwhite "^ *syntax [^ ]*"
# color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
# color white "^ *color\>.*"
# color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
# color magenta "^ *color\>"
# color green "^#.*$"
# syntax "nanorc" "(\.)?nanorc$"
# color brightwhite "^ *(set|unset|syntax|color).*$"
# color cyan "^ *(set|unset)([ ]+)(autoindent|backup|const|cut|fill|historylog|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|rebinddelete|regexp|smooth|speller|suspend|tabsize|tempfile|view)"
# color green "^ *(set|unset|syntax)\>"
# 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)="
# color white "\"(\\.|[^\"])*\""
# color blue "^ *#.*$"

View File

@ -170,7 +170,7 @@ char *parse_argument(char *ptr)
ptr = NULL;
else
*ptr++ = '\0';
rcfile_error(_("argument %s has unterminated \""), ptr_bak);
rcfile_error(_("Argument %s has unterminated \""), ptr_bak);
} else {
*last_quote = '\0';
ptr = last_quote + 1;
@ -212,11 +212,11 @@ int colortoint(const char *colorname, int *bright)
else if (!strcasecmp(colorname, "black"))
mcolor = COLOR_BLACK;
else {
rcfile_error(_("color %s not understood.\n"
rcfile_error(_("Color %s not understood.\n"
"Valid colors are \"green\", \"red\", \"blue\", \n"
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
"\"black\", with the optional prefix \"bright\".\n"),
colorname);
"\"black\", with the optional prefix \"bright\" \n"
"for foreground colors.\n"), colorname);
mcolor = -1;
}
return mcolor;
@ -271,7 +271,7 @@ void parse_syntax(char *ptr)
return;
if (*ptr != '"') {
rcfile_error(_("regex strings must begin and end with a \" character\n"));
rcfile_error(_("Regex strings must begin and end with a \" character\n"));
return;
}
ptr++;
@ -354,8 +354,14 @@ void parse_colors(char *ptr)
}
if (strstr(fgstr, ",")) {
char *bgcolorname;
strtok(fgstr, ",");
bg = colortoint(strtok(NULL, ","), &bright);
bgcolorname = strtok(NULL, ",");
if (!strncasecmp(bgcolorname, "bright", 6)) {
rcfile_error(_("Background color %s cannot be bright"), bgcolorname);
return;
}
bg = colortoint(bgcolorname, &bright);
} else
bg = -1;
@ -395,7 +401,7 @@ void parse_colors(char *ptr)
}
if (*ptr != '"') {
rcfile_error(_("regex strings must begin and end with a \" character\n"));
rcfile_error(_("Regex strings must begin and end with a \" character\n"));
ptr = parse_next_regex(ptr);
continue;
}
@ -442,7 +448,7 @@ void parse_colors(char *ptr)
if (*ptr != '"') {
rcfile_error(_
("regex strings must begin and end with a \" character\n"));
("Regex strings must begin and end with a \" character\n"));
continue;
}
ptr++;
@ -538,7 +544,7 @@ void parse_rcfile(FILE *rcstream)
) {
if (*ptr == '\n' || *ptr == '\0') {
rcfile_error(_
("option %s requires an argument"),
("Option %s requires an argument"),
rcopts[i].name);
continue;
}
@ -563,7 +569,7 @@ void parse_rcfile(FILE *rcstream)
* errors. */
j = (int)strtol(option, &first_error, 10);
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
rcfile_error(_("requested fill size %d invalid"),
rcfile_error(_("Requested fill size %d invalid"),
j);
else
wrap_at = j;
@ -587,7 +593,7 @@ void parse_rcfile(FILE *rcstream)
* errors. */
j = (int)strtol(option, &first_error, 10);
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
rcfile_error(_("requested tab size %d invalid"),
rcfile_error(_("Requested tab size %d invalid"),
j);
else
tabsize = j;