summaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-04-11 14:19:33 -0700
committerKevin McCarthy <kevin@8t8.us>2021-04-15 17:58:56 -0700
commitc20a5169f7a3b5525f1d8c0ee4b0743d8358a98c (patch)
treeee113d04cbc384279f23c4ea0063d4034fff8ef0 /menu.c
parent869c6cc49ccd861f78990dd60e5c3ec770511700 (diff)
Use bkgrndset() as ATTRSET() backend if available.
This function allows more usable color pairs, because it passes the pair parameter separately. The COLOR_PAIR() macro only returns 8-bits for a pair, limiting the total pairs used to 256 despite many systems having much larger COLOR_PAIRS values. In order to do this, separate out the pair and attrs values, instead of combining attr + COLOR_PAIR(pair) into a single value and storing that inside Mutt. For the older calls, bkgdset() and attrset(), we call COLOR_PAIR() at the last minute. Add COLOR_ATTR to header cache sum calculation, since it is used in the HEADER now.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/menu.c b/menu.c
index 59c94a2c..554296c2 100644
--- a/menu.c
+++ b/menu.c
@@ -35,13 +35,14 @@ static size_t MenuStackCount = 0;
static size_t MenuStackLen = 0;
static MUTTMENU **MenuStack = NULL;
-static void print_enriched_string (int base_color, unsigned char *s, int use_indicator)
+static void print_enriched_string (COLOR_ATTR base_color, unsigned char *s,
+ int use_indicator)
{
wchar_t wc;
size_t k;
size_t n = mutt_strlen ((char *)s);
mbstate_t mbstate;
- int tree_color;
+ COLOR_ATTR tree_color;
if (option (OPTCURSOROVERLAY))
{
@@ -272,7 +273,7 @@ void menu_redraw_index (MUTTMENU *menu)
{
char buf[LONG_STRING];
int i;
- int attr;
+ COLOR_ATTR attr;
for (i = menu->top; i < menu->top + menu->pagelen; i++)
{
@@ -320,7 +321,7 @@ void menu_redraw_index (MUTTMENU *menu)
void menu_redraw_motion (MUTTMENU *menu)
{
char buf[LONG_STRING];
- int old_color, cur_color;
+ COLOR_ATTR old_color, cur_color;
if (menu->dialog)
{
@@ -374,7 +375,7 @@ void menu_redraw_motion (MUTTMENU *menu)
void menu_redraw_current (MUTTMENU *menu)
{
char buf[LONG_STRING];
- int attr = menu->color (menu->current);
+ COLOR_ATTR attr = menu->color (menu->current);
mutt_window_move (menu->indexwin, menu->current + menu->offset - menu->top, 0);
menu_make_entry (buf, sizeof (buf), menu, menu->current);
@@ -705,7 +706,7 @@ static void menu_prev_entry (MUTTMENU *menu)
mutt_error _("You are on the first entry.");
}
-static int default_color (int i)
+static COLOR_ATTR default_color (int i)
{
return ColorDefs[MT_COLOR_NORMAL];
}