commit 46e769a1137b94f0c134e3ee038efbb32c489f7f
parent 79545187b8c28afac0879a4b4eafd1775ddb0191
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 28 Aug 2020 18:40:10 +0200
rcfile: add 'set scrollercolor', for changing the color of the indicator
This fulfills https://savannah.gnu.org/bugs/?59041.
Diffstat:
5 files changed, 8 insertions(+), 2 deletions(-)
diff --git 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
@@ -481,6 +481,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
@@ -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
@@ -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
@@ -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]);
}
}