From 916b4d81d0210b890ebcfcd3fcaa92b70a3bf84a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 3 Mar 2019 11:04:19 +0100 Subject: [PATCH] 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. --- src/color.c | 2 ++ src/nano.c | 1 + src/nano.h | 1 + src/rcfile.c | 3 +++ src/winio.c | 4 ++-- syntax/nanorc.nanorc | 4 ++-- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/color.c b/src/color.c index 077204f3..0aeb45e3 100644 --- a/src/color.c +++ b/src/color.c @@ -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; diff --git a/src/nano.c b/src/nano.c index b2a51736..d75f96c6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -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; diff --git a/src/nano.h b/src/nano.h index 555086fe..31d5cd53 100644 --- a/src/nano.h +++ b/src/nano.h @@ -486,6 +486,7 @@ enum { TITLE_BAR = 0, LINE_NUMBER, + GUIDE_STRIPE, SELECTED_TEXT, STATUS_BAR, ERROR_MESSAGE, diff --git a/src/rcfile.c b/src/rcfile.c index c10b9d58..9bef96ad 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -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) diff --git a/src/winio.c b/src/winio.c index b23d2687..7c68a09e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -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 diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 8b110e9c..687fde61 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -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:]]+.*"