nano-devel
[Top][All Lists]
Advanced

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

[PATCH 1/2] rcfile: add 'set scrollercolor', for changing the color of t


From: Benno Schulenberg
Subject: [PATCH 1/2] rcfile: add 'set scrollercolor', for changing the color of the indicator
Date: Sun, 30 Aug 2020 17:04:47 +0200

This fulfills https://savannah.gnu.org/bugs/?59041.
---
 src/color.c       | 2 +-
 src/definitions.h | 1 +
 src/nano.c        | 1 +
 src/rcfile.c      | 3 +++
 src/winio.c       | 3 ++-
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/color.c b/src/color.c
index 6e225b20..08cb5d8e 100644
--- a/src/color.c
+++ b/src/color.c
@@ -64,7 +64,7 @@ void set_interface_colorpairs(void)
                        interface_color_pair[index] = COLOR_PAIR(index + 1) | 
A_BANDAID |
                                                                                
                combo->attributes;
                } else {
-                       if (index == FUNCTION_TAG)
+                       if (index == FUNCTION_TAG || index == SCROLL_BAR)
                                interface_color_pair[index] = A_NORMAL;
                        else if (index == GUIDE_STRIPE)
                                interface_color_pair[index] = A_REVERSE;
diff --git a/src/definitions.h b/src/definitions.h
index 91f10d00..bb682bc4 100644
--- a/src/definitions.h
+++ b/src/definitions.h
@@ -485,6 +485,7 @@ enum
        TITLE_BAR = 0,
        LINE_NUMBER,
        GUIDE_STRIPE,
+       SCROLL_BAR,
        SELECTED_TEXT,
        STATUS_BAR,
        ERROR_MESSAGE,
diff --git a/src/nano.c b/src/nano.c
index 4da79678..e22677bf 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2297,6 +2297,7 @@ int main(int argc, char **argv)
                interface_color_pair[TITLE_BAR] = hilite_attribute;
                interface_color_pair[LINE_NUMBER] = hilite_attribute;
                interface_color_pair[GUIDE_STRIPE] = A_REVERSE;
+               interface_color_pair[SCROLL_BAR] = A_NORMAL;
                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/rcfile.c b/src/rcfile.c
index c259cc7d..32815ed7 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -126,6 +126,7 @@ static const rcoption rcopts[] = {
        {"titlecolor", 0},
        {"numbercolor", 0},
        {"stripecolor", 0},
+       {"scrollercolor", 0},
        {"selectedcolor", 0},
        {"statuscolor", 0},
        {"errorcolor", 0},
@@ -1551,6 +1552,8 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool 
intros_only)
                        color_combo[LINE_NUMBER] = 
parse_interface_color(argument);
                else if (strcmp(option, "stripecolor") == 0)
                        color_combo[GUIDE_STRIPE] = 
parse_interface_color(argument);
+               else if (strcmp(option, "scrollercolor") == 0)
+                       color_combo[SCROLL_BAR] = 
parse_interface_color(argument);
                else if (strcmp(option, "selectedcolor") == 0)
                        color_combo[SELECTED_TEXT] = 
parse_interface_color(argument);
                else if (strcmp(option, "statuscolor") == 0)
diff --git a/src/winio.c b/src/winio.c
index a174e37b..93d0e9c8 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2882,7 +2882,8 @@ void draw_scrollbar(void)
                highest = editwinrows;
 
        for (int row = 0; row < editwinrows; row++) {
-               bardata[row] = ' '|((row >= lowest && row <= highest) ? 
A_REVERSE : 0);
+               bardata[row] = ' '|interface_color_pair[SCROLL_BAR]|
+                                       ((row < lowest || row > highest) ? 
A_NORMAL : A_REVERSE);
                mvwaddch(edit, row, COLS - 1, bardata[row]);
        }
 }
-- 
2.25.4




reply via email to

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