options: accept 'set minicolor' for setting the color of the minibar

When it is not specified, it defaults to the value for 'titlecolor'.

When not using --minibar, I want the title bar to be blue (as that is
how I've always had it), but with --minibar, I want this mini bar to
be grey, as otherwise it reminds me too much of the prompt bar.

Also, colorize 'set minicolor' as valid in a nanorc file.
This commit is contained in:
Benno Schulenberg 2021-06-07 12:10:23 +02:00
parent 3f340836a6
commit e2e8bf0a3e
6 changed files with 10 additions and 5 deletions

View File

@ -61,7 +61,7 @@ void set_interface_colorpairs(void)
else if (index == SPOTLIGHTED) { else if (index == SPOTLIGHTED) {
init_pair(index + 1, COLOR_BLACK, COLOR_YELLOW + (COLORS > 15 ? 8 : 0)); init_pair(index + 1, COLOR_BLACK, COLOR_YELLOW + (COLORS > 15 ? 8 : 0));
interface_color_pair[index] = COLOR_PAIR(index + 1); interface_color_pair[index] = COLOR_PAIR(index + 1);
} else if (index == PROMPT_BAR) } else if (index == MINI_INFOBAR || index == PROMPT_BAR)
interface_color_pair[index] = interface_color_pair[TITLE_BAR]; interface_color_pair[index] = interface_color_pair[TITLE_BAR];
else if (index == ERROR_MESSAGE) { else if (index == ERROR_MESSAGE) {
init_pair(index + 1, COLOR_WHITE, COLOR_RED); init_pair(index + 1, COLOR_WHITE, COLOR_RED);

View File

@ -283,6 +283,7 @@ enum {
SCROLL_BAR, SCROLL_BAR,
SELECTED_TEXT, SELECTED_TEXT,
SPOTLIGHTED, SPOTLIGHTED,
MINI_INFOBAR,
PROMPT_BAR, PROMPT_BAR,
STATUS_BAR, STATUS_BAR,
ERROR_MESSAGE, ERROR_MESSAGE,

View File

@ -2298,6 +2298,7 @@ int main(int argc, char **argv)
interface_color_pair[SCROLL_BAR] = A_NORMAL; interface_color_pair[SCROLL_BAR] = A_NORMAL;
interface_color_pair[SELECTED_TEXT] = hilite_attribute; interface_color_pair[SELECTED_TEXT] = hilite_attribute;
interface_color_pair[SPOTLIGHTED] = A_REVERSE; interface_color_pair[SPOTLIGHTED] = A_REVERSE;
interface_color_pair[MINI_INFOBAR] = hilite_attribute;
interface_color_pair[PROMPT_BAR] = hilite_attribute; interface_color_pair[PROMPT_BAR] = hilite_attribute;
interface_color_pair[STATUS_BAR] = hilite_attribute; interface_color_pair[STATUS_BAR] = hilite_attribute;
interface_color_pair[ERROR_MESSAGE] = hilite_attribute; interface_color_pair[ERROR_MESSAGE] = hilite_attribute;

View File

@ -130,6 +130,7 @@ static const rcoption rcopts[] = {
{"scrollercolor", 0}, {"scrollercolor", 0},
{"selectedcolor", 0}, {"selectedcolor", 0},
{"spotlightcolor", 0}, {"spotlightcolor", 0},
{"minicolor", 0},
{"promptcolor", 0}, {"promptcolor", 0},
{"statuscolor", 0}, {"statuscolor", 0},
{"errorcolor", 0}, {"errorcolor", 0},
@ -1550,6 +1551,8 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
color_combo[SELECTED_TEXT] = parse_interface_color(argument); color_combo[SELECTED_TEXT] = parse_interface_color(argument);
else if (strcmp(option, "spotlightcolor") == 0) else if (strcmp(option, "spotlightcolor") == 0)
color_combo[SPOTLIGHTED] = parse_interface_color(argument); color_combo[SPOTLIGHTED] = parse_interface_color(argument);
else if (strcmp(option, "minicolor") == 0)
color_combo[MINI_INFOBAR] = parse_interface_color(argument);
else if (strcmp(option, "promptcolor") == 0) else if (strcmp(option, "promptcolor") == 0)
color_combo[PROMPT_BAR] = parse_interface_color(argument); color_combo[PROMPT_BAR] = parse_interface_color(argument);
else if (strcmp(option, "statuscolor") == 0) else if (strcmp(option, "statuscolor") == 0)

View File

@ -2117,7 +2117,7 @@ void minibar(void)
#endif #endif
/* Draw a colored bar over the full width of the screen. */ /* Draw a colored bar over the full width of the screen. */
wattron(bottomwin, interface_color_pair[TITLE_BAR]); wattron(bottomwin, interface_color_pair[MINI_INFOBAR]);
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " "); mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
if (openfile->filename[0] != '\0') { if (openfile->filename[0] != '\0') {
@ -2229,7 +2229,7 @@ void minibar(void)
mvwaddstr(bottomwin, 0, COLS - 4 - padding, location); mvwaddstr(bottomwin, 0, COLS - 4 - padding, location);
} }
wattroff(bottomwin, interface_color_pair[TITLE_BAR]); wattroff(bottomwin, interface_color_pair[MINI_INFOBAR]);
wrefresh(bottomwin); wrefresh(bottomwin);
free(number_of_lines); free(number_of_lines);

View File

@ -7,11 +7,11 @@ comment "#"
color brightred ".*" color brightred ".*"
# Color names # Color names
color yellow "^[[:blank:]]*(i?color|set[[:blank:]]+((error|function|key|number|prompt|scroller|selected|spotlight|status|stripe|title)color))[[:blank:]]+(bold,)?(italic,)?(((bright|light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray)?(,(((light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray))?\>" color yellow "^[[:blank:]]*(i?color|set[[:blank:]]+((error|function|key|mini|number|prompt|scroller|selected|spotlight|status|stripe|title)color))[[:blank:]]+(bold,)?(italic,)?(((bright|light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray)?(,(((light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray))?\>"
# Keywords # Keywords
color brightgreen "^[[:blank:]]*(set|unset)[[:blank:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|boldtext|bookstyle|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|historylog|indicator|jumpyscrolling|linenumbers|locking|magic|minibar|mouse|multibuffer|noconvert|nohelp|nonewlines|positionlog|preserve|quickblank|rawsequences|rebinddelete|regexp|saveonexit|showcursor|smarthome|softwrap|stateflags|suspendable|tabstospaces|trimblanks|unix|wordbounds|zap)\>" color brightgreen "^[[:blank:]]*(set|unset)[[:blank:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|boldtext|bookstyle|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|historylog|indicator|jumpyscrolling|linenumbers|locking|magic|minibar|mouse|multibuffer|noconvert|nohelp|nonewlines|positionlog|preserve|quickblank|rawsequences|rebinddelete|regexp|saveonexit|showcursor|smarthome|softwrap|stateflags|suspendable|tabstospaces|trimblanks|unix|wordbounds|zap)\>"
color brightgreen "^[[:blank:]]*set[[:blank:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|promptcolor|punct|quotestr|scrollercolor|selectedcolor|speller|spotlightcolor|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:blank:]]+" color brightgreen "^[[:blank:]]*set[[:blank:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|minicolor|numbercolor|operatingdir|promptcolor|punct|quotestr|scrollercolor|selectedcolor|speller|spotlightcolor|statuscolor|stripecolor|titlecolor|whitespace|wordchars)[[:blank:]]+"
color brightgreen "^[[:blank:]]*set[[:blank:]]+(fill[[:blank:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:blank:]]+[1-9][0-9]*)\>" color brightgreen "^[[:blank:]]*set[[:blank:]]+(fill[[:blank:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:blank:]]+[1-9][0-9]*)\>"
color brightgreen "^[[:blank:]]*bind[[:blank:]]+((\^([A-Za-z]|[]/@\^_`-]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:blank:]]+([a-z]+|".*")[[:blank:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:blank:]]+#|[[:blank:]]*$)" color brightgreen "^[[:blank:]]*bind[[:blank:]]+((\^([A-Za-z]|[]/@\^_`-]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:blank:]]+([a-z]+|".*")[[:blank:]]+(main|help|search|replace(with)?|yesno|gotoline|writeout|insert|browser|whereisfile|gotodir|execute|spell|linter|all)([[:blank:]]+#|[[:blank:]]*$)"
color brightgreen "^[[:blank:]]*unbind[[:blank:]]+((\^([A-Za-z]|[]/@\^_`-]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:blank:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:blank:]]+#|[[:blank:]]*$)" color brightgreen "^[[:blank:]]*unbind[[:blank:]]+((\^([A-Za-z]|[]/@\^_`-]|Space)|([Ss][Hh]-)?[Mm]-[A-Za-z]|[Mm]-([][!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:blank:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:blank:]]+#|[[:blank:]]*$)"