From e2e8bf0a3e8a289cb1d9d104014a94075d06680b Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 7 Jun 2021 12:10:23 +0200 Subject: [PATCH] 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. --- src/color.c | 2 +- src/definitions.h | 1 + src/nano.c | 1 + src/rcfile.c | 3 +++ src/winio.c | 4 ++-- syntax/nanorc.nanorc | 4 ++-- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/color.c b/src/color.c index aab788ba..dcd98d91 100644 --- a/src/color.c +++ b/src/color.c @@ -61,7 +61,7 @@ void set_interface_colorpairs(void) else if (index == SPOTLIGHTED) { init_pair(index + 1, COLOR_BLACK, COLOR_YELLOW + (COLORS > 15 ? 8 : 0)); 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]; else if (index == ERROR_MESSAGE) { init_pair(index + 1, COLOR_WHITE, COLOR_RED); diff --git a/src/definitions.h b/src/definitions.h index d165a698..b7b75e86 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -283,6 +283,7 @@ enum { SCROLL_BAR, SELECTED_TEXT, SPOTLIGHTED, + MINI_INFOBAR, PROMPT_BAR, STATUS_BAR, ERROR_MESSAGE, diff --git a/src/nano.c b/src/nano.c index fe226849..7ff48ee3 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2298,6 +2298,7 @@ int main(int argc, char **argv) interface_color_pair[SCROLL_BAR] = A_NORMAL; interface_color_pair[SELECTED_TEXT] = hilite_attribute; interface_color_pair[SPOTLIGHTED] = A_REVERSE; + interface_color_pair[MINI_INFOBAR] = hilite_attribute; interface_color_pair[PROMPT_BAR] = hilite_attribute; interface_color_pair[STATUS_BAR] = hilite_attribute; interface_color_pair[ERROR_MESSAGE] = hilite_attribute; diff --git a/src/rcfile.c b/src/rcfile.c index 3218ba1d..ea0e1f7e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -130,6 +130,7 @@ static const rcoption rcopts[] = { {"scrollercolor", 0}, {"selectedcolor", 0}, {"spotlightcolor", 0}, + {"minicolor", 0}, {"promptcolor", 0}, {"statuscolor", 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); else if (strcmp(option, "spotlightcolor") == 0) 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) color_combo[PROMPT_BAR] = parse_interface_color(argument); else if (strcmp(option, "statuscolor") == 0) diff --git a/src/winio.c b/src/winio.c index 7a5f4c2c..17d72a74 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2117,7 +2117,7 @@ void minibar(void) #endif /* 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, " "); if (openfile->filename[0] != '\0') { @@ -2229,7 +2229,7 @@ void minibar(void) mvwaddstr(bottomwin, 0, COLS - 4 - padding, location); } - wattroff(bottomwin, interface_color_pair[TITLE_BAR]); + wattroff(bottomwin, interface_color_pair[MINI_INFOBAR]); wrefresh(bottomwin); free(number_of_lines); diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index b5c1ada1..27a0438b 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -7,11 +7,11 @@ comment "#" color brightred ".*" # 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 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:]]*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:]]*$)"