From: Kevin McCarthy Date: Fri, 9 Jan 2015 22:22:01 +0000 (-0800) Subject: Add color type for prompts. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4cab506c58db6bf887d5a0735c6b9598f21fe79;p=mutt Add color type for prompts. This adds a new color type, MT_COLOR_PROMPT, that can be used to colorize prompts (fields, yes/no, multi_choice). Thanks to Ben Boeckel for the patch! --- diff --git a/color.c b/color.c index ef97ca94..64a46dc6 100644 --- a/color.c +++ b/color.c @@ -93,6 +93,7 @@ static const struct mapping_t Fields[] = { "bold", MT_COLOR_BOLD }, { "underline", MT_COLOR_UNDERLINE }, { "index", MT_COLOR_INDEX }, + { "prompt", MT_COLOR_PROMPT }, { NULL, 0 } }; diff --git a/contrib/colors.default b/contrib/colors.default index 84298e9a..1cbc8d7e 100644 --- a/contrib/colors.default +++ b/contrib/colors.default @@ -6,6 +6,7 @@ color hdrdefault blue white color quoted blue white color signature red white color attachment red white +color prompt brightmagenta white color message brightred white color error brightred white color indicator brightyellow red diff --git a/contrib/colors.linux b/contrib/colors.linux index 1366a9c1..39b16b2b 100644 --- a/contrib/colors.linux +++ b/contrib/colors.linux @@ -6,6 +6,7 @@ color hdrdefault blue black color quoted blue black color signature blue black color attachment red black +color prompt brightmagenta black color message brightred black color error brightred black color indicator black red diff --git a/curs_lib.c b/curs_lib.c index 355c899a..23696129 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -139,7 +139,9 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, do { CLEARLINE (LINES-1); + SETCOLOR (MT_COLOR_PROMPT); addstr ((char *)field); /* cast to get around bad prototypes */ + NORMAL_COLOR; mutt_refresh (); getyx (stdscr, y, x); ret = _mutt_enter_string (buf, buflen, y, x, complete, multiple, files, numfiles, es); @@ -225,8 +227,10 @@ int mutt_yesorno (const char *msg, int def) answer_string_len = mutt_strwidth (answer_string); /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */ msglen = mutt_wstr_trunc (msg, 4*COLS, COLS - answer_string_len, NULL); + SETCOLOR (MT_COLOR_PROMPT); addnstr (msg, msglen); addstr (answer_string); + NORMAL_COLOR; FREE (&answer_string); FOREVER @@ -647,7 +651,9 @@ int mutt_multi_choice (char *prompt, char *letters) int choice; char *p; + SETCOLOR (MT_COLOR_PROMPT); mvaddstr (LINES - 1, 0, prompt); + NORMAL_COLOR; clrtoeol (); FOREVER { diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 5a741a5a..37606670 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -2644,6 +2644,7 @@ specify one or the other). markers (the + markers at the beginning of wrapped lines in the pager) message (informational messages) normal +prompt quoted (text matching $quote_regexp in the body of a message) quoted1, quoted2, ..., quotedN (higher levels of quoting) search (highlighting of words in the pager) diff --git a/doc/muttrc.man.head b/doc/muttrc.man.head index 30b96a23..30d113f1 100644 --- a/doc/muttrc.man.head +++ b/doc/muttrc.man.head @@ -233,7 +233,7 @@ objects. Valid objects are: .BR hdrdefault ", " index ", " indicator ", " markers ", " .BR message ", " normal ", " quoted ", " quoted\fIN\fP ", " .BR search ", " signature ", " status ", " tilde ", " tree ", " -.BR underline . +.BR underline ", " prompt . The .BR body " and " header objects allow you to restrict the colorization to a regular diff --git a/mutt_curses.h b/mutt_curses.h index f8d6f88a..f8bc47cc 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -120,6 +120,7 @@ enum MT_COLOR_BOLD, MT_COLOR_UNDERLINE, MT_COLOR_INDEX, + MT_COLOR_PROMPT, MT_COLOR_MAX };