nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit b87d7f69fcc133e52b48e06844754c0d9f32305e
parent 8ba653f395424c129eb9897a0d833f5b0d77213e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  6 Dec 2020 15:49:35 +0100

options: accept 'set promptcolor' for setting the color of the prompt bar

When it is not specified, it defaults to the value for 'titlecolor'.

Diffstat:
Msrc/color.c | 2++
Msrc/definitions.h | 1+
Msrc/nano.c | 1+
Msrc/prompt.c | 8++++----
Msrc/rcfile.c | 3+++
5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/color.c b/src/color.c @@ -58,6 +58,8 @@ void set_interface_colorpairs(void) interface_color_pair[index] = A_NORMAL; else if (index == GUIDE_STRIPE) interface_color_pair[index] = A_REVERSE; + else if (index == PROMPT_BAR) + interface_color_pair[index] = interface_color_pair[TITLE_BAR]; else if (index == ERROR_MESSAGE) { init_pair(index + 1, COLOR_WHITE, COLOR_RED); interface_color_pair[index] = COLOR_PAIR(index + 1) | A_BOLD; diff --git a/src/definitions.h b/src/definitions.h @@ -288,6 +288,7 @@ enum { GUIDE_STRIPE, SCROLL_BAR, SELECTED_TEXT, + PROMPT_BAR, STATUS_BAR, ERROR_MESSAGE, KEY_COMBO, diff --git a/src/nano.c b/src/nano.c @@ -2295,6 +2295,7 @@ int main(int argc, char **argv) interface_color_pair[GUIDE_STRIPE] = A_REVERSE; interface_color_pair[SCROLL_BAR] = A_NORMAL; interface_color_pair[SELECTED_TEXT] = hilite_attribute; + interface_color_pair[PROMPT_BAR] = hilite_attribute; interface_color_pair[STATUS_BAR] = hilite_attribute; interface_color_pair[ERROR_MESSAGE] = hilite_attribute; interface_color_pair[KEY_COMBO] = hilite_attribute; diff --git a/src/prompt.c b/src/prompt.c @@ -391,7 +391,7 @@ void draw_the_promptbar(void) end_page = get_statusbar_page_start(base, base + breadth(answer) - 1); /* Color the promptbar over its full width. */ - wattron(bottomwin, interface_color_pair[TITLE_BAR]); + wattron(bottomwin, interface_color_pair[PROMPT_BAR]); mvwprintw(bottomwin, 0, 0, "%*s", COLS, " "); mvwaddstr(bottomwin, 0, 0, prompt); @@ -405,7 +405,7 @@ void draw_the_promptbar(void) if (base + breadth(answer) != COLS && the_page < end_page) mvwaddch(bottomwin, 0, COLS - 1, '>'); - wattroff(bottomwin, interface_color_pair[TITLE_BAR]); + wattroff(bottomwin, interface_color_pair[PROMPT_BAR]); /* Place the cursor at the right spot. */ column = base + wideness(answer, typing_x); @@ -685,10 +685,10 @@ int do_yesno_prompt(bool all, const char *msg) } /* Color the promptbar over its full width and display the question. */ - wattron(bottomwin, interface_color_pair[TITLE_BAR]); + wattron(bottomwin, interface_color_pair[PROMPT_BAR]); mvwprintw(bottomwin, 0, 0, "%*s", COLS, " "); mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1)); - wattroff(bottomwin, interface_color_pair[TITLE_BAR]); + wattroff(bottomwin, interface_color_pair[PROMPT_BAR]); wnoutrefresh(bottomwin); currmenu = MYESNO; diff --git a/src/rcfile.c b/src/rcfile.c @@ -131,6 +131,7 @@ static const rcoption rcopts[] = { {"stripecolor", 0}, {"scrollercolor", 0}, {"selectedcolor", 0}, + {"promptcolor", 0}, {"statuscolor", 0}, {"errorcolor", 0}, {"keycolor", 0}, @@ -1554,6 +1555,8 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only) 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, "promptcolor") == 0) + color_combo[PROMPT_BAR] = parse_interface_color(argument); else if (strcmp(option, "statuscolor") == 0) color_combo[STATUS_BAR] = parse_interface_color(argument); else if (strcmp(option, "errorcolor") == 0)