minor rcfile fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1540 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
74ea836fcc
commit
3bd9628b38
|
@ -61,6 +61,12 @@ CVS code -
|
||||||
support, pressing Ctrl-Z to suspend nano at the Linux console
|
support, pressing Ctrl-Z to suspend nano at the Linux console
|
||||||
with keypad(TRUE) generates Ctrl-Z instead of KEY_SUSPEND
|
with keypad(TRUE) generates Ctrl-Z instead of KEY_SUSPEND
|
||||||
(which is what ncurses generates then). (DLR)
|
(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:
|
- winio.c:
|
||||||
titlebar()
|
titlebar()
|
||||||
- Fix problem with the available space for a filename on the
|
- Fix problem with the available space for a filename on the
|
||||||
|
@ -82,6 +88,9 @@ CVS code -
|
||||||
- nanorc.sample:
|
- nanorc.sample:
|
||||||
- Remove duplicate "historylog" entry, remove "keypad" entry,
|
- Remove duplicate "historylog" entry, remove "keypad" entry,
|
||||||
and add "rebinddelete" entry. (DLR)
|
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
|
- AUTHORS
|
||||||
- Updated to show 1.2/1.3 maintainers.
|
- Updated to show 1.2/1.3 maintainers.
|
||||||
|
|
||||||
|
|
|
@ -193,16 +193,15 @@
|
||||||
# color blue "//.*"
|
# color blue "//.*"
|
||||||
# color blue start="/\*" end="\*/"
|
# color blue start="/\*" end="\*/"
|
||||||
# color brightblue start="/\*\*" end="\*/"
|
# color brightblue start="/\*\*" end="\*/"
|
||||||
# color brightgreen,brightgreen "[ ]+$"
|
# color green,brightgreen "[ ]+$"
|
||||||
|
|
||||||
## Here is an example for your .nanorc
|
## Here is an example for your .nanorc
|
||||||
##
|
##
|
||||||
# syntax "nanorc" "[\.]*nanorc$"
|
# syntax "nanorc" "(\.)?nanorc$"
|
||||||
# color white "^ *(set|unset).*$"
|
# color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||||
# 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 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 brightwhite "^ *syntax [^ ]*"
|
# color green "^ *(set|unset|syntax)\>"
|
||||||
# color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
|
# color yellow "^ *color([ ]+)(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||||
# color white "^ *color\>.*"
|
# color magenta "^ *color\>" "\<(start|end)="
|
||||||
# color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
|
# color white "\"(\\.|[^\"])*\""
|
||||||
# color magenta "^ *color\>"
|
# color blue "^ *#.*$"
|
||||||
# color green "^#.*$"
|
|
||||||
|
|
28
rcfile.c
28
rcfile.c
|
@ -170,7 +170,7 @@ char *parse_argument(char *ptr)
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
else
|
else
|
||||||
*ptr++ = '\0';
|
*ptr++ = '\0';
|
||||||
rcfile_error(_("argument %s has unterminated \""), ptr_bak);
|
rcfile_error(_("Argument %s has unterminated \""), ptr_bak);
|
||||||
} else {
|
} else {
|
||||||
*last_quote = '\0';
|
*last_quote = '\0';
|
||||||
ptr = last_quote + 1;
|
ptr = last_quote + 1;
|
||||||
|
@ -212,11 +212,11 @@ int colortoint(const char *colorname, int *bright)
|
||||||
else if (!strcasecmp(colorname, "black"))
|
else if (!strcasecmp(colorname, "black"))
|
||||||
mcolor = COLOR_BLACK;
|
mcolor = COLOR_BLACK;
|
||||||
else {
|
else {
|
||||||
rcfile_error(_("color %s not understood.\n"
|
rcfile_error(_("Color %s not understood.\n"
|
||||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||||
"\"black\", with the optional prefix \"bright\".\n"),
|
"\"black\", with the optional prefix \"bright\" \n"
|
||||||
colorname);
|
"for foreground colors.\n"), colorname);
|
||||||
mcolor = -1;
|
mcolor = -1;
|
||||||
}
|
}
|
||||||
return mcolor;
|
return mcolor;
|
||||||
|
@ -271,7 +271,7 @@ void parse_syntax(char *ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*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"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -354,8 +354,14 @@ void parse_colors(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(fgstr, ",")) {
|
if (strstr(fgstr, ",")) {
|
||||||
|
char *bgcolorname;
|
||||||
strtok(fgstr, ",");
|
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
|
} else
|
||||||
bg = -1;
|
bg = -1;
|
||||||
|
|
||||||
|
@ -395,7 +401,7 @@ void parse_colors(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*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);
|
ptr = parse_next_regex(ptr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -442,7 +448,7 @@ void parse_colors(char *ptr)
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(_
|
rcfile_error(_
|
||||||
("regex strings must begin and end with a \" character\n"));
|
("Regex strings must begin and end with a \" character\n"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -538,7 +544,7 @@ void parse_rcfile(FILE *rcstream)
|
||||||
) {
|
) {
|
||||||
if (*ptr == '\n' || *ptr == '\0') {
|
if (*ptr == '\n' || *ptr == '\0') {
|
||||||
rcfile_error(_
|
rcfile_error(_
|
||||||
("option %s requires an argument"),
|
("Option %s requires an argument"),
|
||||||
rcopts[i].name);
|
rcopts[i].name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +569,7 @@ void parse_rcfile(FILE *rcstream)
|
||||||
* errors. */
|
* errors. */
|
||||||
j = (int)strtol(option, &first_error, 10);
|
j = (int)strtol(option, &first_error, 10);
|
||||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||||
rcfile_error(_("requested fill size %d invalid"),
|
rcfile_error(_("Requested fill size %d invalid"),
|
||||||
j);
|
j);
|
||||||
else
|
else
|
||||||
wrap_at = j;
|
wrap_at = j;
|
||||||
|
@ -587,7 +593,7 @@ void parse_rcfile(FILE *rcstream)
|
||||||
* errors. */
|
* errors. */
|
||||||
j = (int)strtol(option, &first_error, 10);
|
j = (int)strtol(option, &first_error, 10);
|
||||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||||
rcfile_error(_("requested tab size %d invalid"),
|
rcfile_error(_("Requested tab size %d invalid"),
|
||||||
j);
|
j);
|
||||||
else
|
else
|
||||||
tabsize = j;
|
tabsize = j;
|
||||||
|
|
Loading…
Reference in New Issue