>From 6a22b7bf8f02d9273f893657de279fb852642011 Mon Sep 17 00:00:00 2001 From: Brand Huntsman Date: Tue, 27 Feb 2018 04:01:19 -0700 Subject: [PATCH] allow prompt to be colored separately from titlebar Signed-off-by: Brand Huntsman --- src/nano.c | 2 ++ src/nano.h | 2 ++ src/prompt.c | 8 ++++---- src/rcfile.c | 6 ++++++ syntax/nanorc.nanorc | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/nano.c b/src/nano.c index 3a413fa6..e39300cd 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2495,6 +2495,8 @@ int main(int argc, char **argv) interface_color_pair[TITLE_BAR] = hilite_attribute; interface_color_pair[LINE_NUMBER] = hilite_attribute; interface_color_pair[SELECTED_TEXT] = hilite_attribute; + interface_color_pair[PROMPT_BAR] = hilite_attribute; + interface_color_pair[YESNO_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/nano.h b/src/nano.h index c092d3e1..dfaf8160 100644 --- a/src/nano.h +++ b/src/nano.h @@ -483,6 +483,8 @@ enum TITLE_BAR = 0, LINE_NUMBER, SELECTED_TEXT, + PROMPT_BAR, + YESNO_BAR, STATUS_BAR, ERROR_MESSAGE, KEY_COMBO, diff --git a/src/prompt.c b/src/prompt.c index c013ed61..54313816 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -399,7 +399,7 @@ void update_the_statusbar(void) end_page = get_statusbar_page_start(base, base + strlenpt(answer) - 1); /* Color the promptbar over its full width. */ - wattron(bottomwin, interface_color_pair[TITLE_BAR]); + wattron(bottomwin, interface_color_pair[PROMPT_BAR]); blank_statusbar(); mvwaddstr(bottomwin, 0, 0, prompt); @@ -412,7 +412,7 @@ void update_the_statusbar(void) waddch(bottomwin, (the_page >= end_page) ? ' ' : '>'); - wattroff(bottomwin, interface_color_pair[TITLE_BAR]); + wattroff(bottomwin, interface_color_pair[PROMPT_BAR]); /* Work around a cursor-misplacement bug in VTEs. */ wmove(bottomwin, 0, 0); @@ -702,10 +702,10 @@ int do_yesno_prompt(bool all, const char *msg) } /* Color the statusbar over its full width and display the question. */ - wattron(bottomwin, interface_color_pair[TITLE_BAR]); + wattron(bottomwin, interface_color_pair[YESNO_BAR]); blank_statusbar(); mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1)); - wattroff(bottomwin, interface_color_pair[TITLE_BAR]); + wattroff(bottomwin, interface_color_pair[YESNO_BAR]); wnoutrefresh(bottomwin); currmenu = MYESNO; diff --git a/src/rcfile.c b/src/rcfile.c index 82f75a53..19eb754e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -114,6 +114,8 @@ static const rcoption rcopts[] = { {"titlecolor", 0}, {"numbercolor", 0}, {"selectedcolor", 0}, + {"promptcolor", 0}, + {"yesnocolor", 0}, {"statuscolor", 0}, {"errorcolor", 0}, {"keycolor", 0}, @@ -1097,6 +1099,10 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) color_combo[LINE_NUMBER] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0) color_combo[SELECTED_TEXT] = parse_interface_color(option); + else if (strcasecmp(rcopts[i].name, "promptcolor") == 0) + color_combo[PROMPT_BAR] = parse_interface_color(option); + else if (strcasecmp(rcopts[i].name, "yesnocolor") == 0) + color_combo[YESNO_BAR] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "statuscolor") == 0) color_combo[STATUS_BAR] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "errorcolor") == 0) diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 9140c1a3..0bd0a997 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -8,8 +8,8 @@ icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comm # Keywords icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>" -icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" -icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+" +icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|prompt|selected|status|title|yesno)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" +icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|promptcolor|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars|yesnocolor)[[:space:]]+" icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>address@hidden|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>address@hidden|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|formatter)[[:space:]]+.*$" -- 2.16.1