nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] [PATCH] small addition: understand color name "normal" to m


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] small addition: understand color name "normal" to mean the default color
Date: Tue, 27 Mar 2018 13:55:38 +0200

This allows a syntax to remove the color from things that were painted
by earlier regexes.
---
 src/rcfile.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c
index c1e6a87f..6bab7f4b 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -602,9 +602,11 @@ short color_to_short(const char *colorname, bool *bright)
                return COLOR_MAGENTA;
        else if (strcasecmp(colorname, "black") == 0)
                return COLOR_BLACK;
+       else if (strcasecmp(colorname, "normal") == 0)
+               return -1;
 
        rcfile_error(N_("Color \"%s\" not understood"), colorname);
-       return -1;
+       return -2;
 }
 
 /* Parse the color string in the line at ptr, and add it to the current
@@ -753,11 +755,14 @@ bool parse_color_names(char *combostr, short *fg, short 
*bg, bool *bright)
                *fg = color_to_short(combostr, bright);
 
                /* If the specified foreground color is bad, ignore the 
regexes. */
-               if (*fg == -1)
+               if (*fg == -2)
                        return FALSE;
        } else
                *fg = -1;
 
+       if (*bg == -2)
+               *bg = -1;
+
        return TRUE;
 }
 
-- 
2.16.2




reply via email to

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