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

When it is not specified, it defaults to the value for 'titlecolor'.
This commit is contained in:
Benno Schulenberg 2020-12-06 15:49:35 +01:00
parent 8ba653f395
commit b87d7f69fc
5 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -288,6 +288,7 @@ enum {
GUIDE_STRIPE,
SCROLL_BAR,
SELECTED_TEXT,
PROMPT_BAR,
STATUS_BAR,
ERROR_MESSAGE,
KEY_COMBO,

View File

@ -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;

View File

@ -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;

View File

@ -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)