rcfile: add 'stripecolor' for changing the color of the guiding stripe

The default is now simply reverse video, which works better than a
"loud" colored bar in an interface that for the rest is monochrome.
This commit is contained in:
Benno Schulenberg 2019-03-03 11:04:19 +01:00
parent 66c6eb5166
commit 916b4d81d0
6 changed files with 11 additions and 4 deletions

View File

@ -70,6 +70,8 @@ void set_colorpairs(void)
} else {
if (i == FUNCTION_TAG)
interface_color_pair[i] = A_NORMAL;
else if (i == GUIDE_STRIPE)
interface_color_pair[i] = A_REVERSE;
else if (i == ERROR_MESSAGE) {
init_pair(i + 1, COLOR_WHITE, COLOR_RED);
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BOLD | A_BANDAID;

View File

@ -2563,6 +2563,7 @@ int main(int argc, char **argv)
#else
interface_color_pair[TITLE_BAR] = hilite_attribute;
interface_color_pair[LINE_NUMBER] = hilite_attribute;
interface_color_pair[GUIDE_STRIPE] = A_REVERSE;
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
interface_color_pair[STATUS_BAR] = hilite_attribute;
interface_color_pair[ERROR_MESSAGE] = hilite_attribute;

View File

@ -486,6 +486,7 @@ enum
{
TITLE_BAR = 0,
LINE_NUMBER,
GUIDE_STRIPE,
SELECTED_TEXT,
STATUS_BAR,
ERROR_MESSAGE,

View File

@ -121,6 +121,7 @@ static const rcoption rcopts[] = {
#ifdef ENABLE_COLOR
{"titlecolor", 0},
{"numbercolor", 0},
{"stripecolor", 0},
{"selectedcolor", 0},
{"statuscolor", 0},
{"errorcolor", 0},
@ -1089,6 +1090,8 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
color_combo[TITLE_BAR] = parse_interface_color(option);
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
color_combo[LINE_NUMBER] = parse_interface_color(option);
else if (strcasecmp(rcopts[i].name, "stripecolor") == 0)
color_combo[GUIDE_STRIPE] = parse_interface_color(option);
else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0)
color_combo[SELECTED_TEXT] = parse_interface_color(option);
else if (strcasecmp(rcopts[i].name, "statuscolor") == 0)

View File

@ -2689,9 +2689,9 @@ void edit_draw(filestruct *fileptr, const char *converted,
const char *text = converted + actual_x(converted, stripe_column - 1);
const char *striped_char = (*text == '\0') ? " " : text;
wattron(edit, interface_color_pair[ERROR_MESSAGE]);
wattron(edit, interface_color_pair[GUIDE_STRIPE]);
mvwaddnstr(edit, row, margin + stripe_column - 1, striped_char, 1);
wattroff(edit, interface_color_pair[ERROR_MESSAGE]);
wattroff(edit, interface_color_pair[GUIDE_STRIPE]);
}
#ifndef NANO_TINY

View File

@ -8,8 +8,8 @@ icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comm
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|fill[[:space:]]+-?[[:digit:]]+|finalnewline|historylog|jumpyscrolling|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|stripe|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*"