summaryrefslogtreecommitdiffstats
path: root/curs_main.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 /curs_main.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 'curs_main.c')
-rw-r--r--curs_main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/curs_main.c b/curs_main.c
index 7d7477fa..edc3eac5 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -269,15 +269,15 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
_mutt_make_string (s, l, NONULL (HdrFmt), Context, h, flag);
}
-int index_color (int index_no)
+COLOR_ATTR index_color (int index_no)
{
HEADER *h = Context->hdrs[Context->v2r[index_no]];
- if (h && h->pair)
- return h->pair;
+ if (h && (h->color.pair || h->color.attrs))
+ return h->color;
mutt_set_header_color (Context, h);
- return h->pair;
+ return h->color;
}
static int ci_next_undeleted (int msgno)
@@ -2657,7 +2657,7 @@ int mutt_index_menu (void)
void mutt_set_header_color (CONTEXT *ctx, HEADER *curhdr)
{
- COLOR_LINE *color;
+ COLOR_LINE *color_line;
pattern_cache_t cache;
if (!curhdr)
@@ -2665,12 +2665,12 @@ void mutt_set_header_color (CONTEXT *ctx, HEADER *curhdr)
memset (&cache, 0, sizeof (cache));
- for (color = ColorIndexList; color; color = color->next)
- if (mutt_pattern_exec (color->color_pattern, MUTT_MATCH_FULL_ADDRESS, ctx, curhdr,
- &cache))
+ for (color_line = ColorIndexList; color_line; color_line = color_line->next)
+ if (mutt_pattern_exec (color_line->color_pattern, MUTT_MATCH_FULL_ADDRESS,
+ ctx, curhdr, &cache))
{
- curhdr->pair = color->pair;
+ curhdr->color = color_line->color;
return;
}
- curhdr->pair = ColorDefs[MT_COLOR_NORMAL];
+ curhdr->color = ColorDefs[MT_COLOR_NORMAL];
}