From 583879fd667d28c46f318a6fbc98017392e603eb Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 3 Mar 2019 11:04:19 +0100
Subject: [PATCH 2/4] rcfile: add 'stripecolor' for changing the color of the
 margin 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/nano.c           | 1 +
 src/nano.h           | 1 +
 src/rcfile.c         | 3 +++
 src/winio.c          | 4 ++--
 syntax/nanorc.nanorc | 4 ++--
 5 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/nano.c b/src/nano.c
index a55eebed..f2e89df7 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[MARGIN_STRIPE] = hilite_attribute;
 	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..55f3658e 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -486,6 +486,7 @@ enum
 {
 	TITLE_BAR = 0,
 	LINE_NUMBER,
+	MARGIN_STRIPE,
 	SELECTED_TEXT,
 	STATUS_BAR,
 	ERROR_MESSAGE,
diff --git a/src/rcfile.c b/src/rcfile.c
index 8099cdbd..cbf704d3 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[MARGIN_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 bc40a179..652c2728 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[MARGIN_STRIPE]);
 		mvwaddnstr(edit, row, margin + stripe_column - 1, striped_char, 1);
-		wattroff(edit, interface_color_pair[ERROR_MESSAGE]);
+		wattroff(edit, interface_color_pair[MARGIN_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:]]+.*"
-- 
2.20.1

