nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH 2/4] rcfile: add 'stripecolor' for changing the colo


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH 2/4] rcfile: add 'stripecolor' for changing the color of the margin stripe
Date: Sun, 3 Mar 2019 12:03:05 +0100

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 | 2 +-
 5 files changed, 8 insertions(+), 3 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 2f1a5edd..bc16044d 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..0ca7e1cf 100644
--- a/syntax/nanorc.nanorc
+++ b/syntax/nanorc.nanorc
@@ -8,7 +8,7 @@ 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 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|titlecolor|whitespace|wordchars)[[:space:]]+"
 icolor brightgreen 
"^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|address@hidden|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>address@hidden|}~-]|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:]]|address@hidden|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>address@hidden|}~-]|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:]]*$)"
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]