diff options
-rw-r--r-- | color.c | 11 | ||||
-rw-r--r-- | curs_main.c | 17 | ||||
-rw-r--r-- | protos.h | 1 | ||||
-rw-r--r-- | score.c | 4 | ||||
-rw-r--r-- | sort.c | 2 |
5 files changed, 19 insertions, 16 deletions
@@ -428,8 +428,11 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err, if (do_cache && !option (OPTNOCURSES)) { - mutt_cache_index_colors (Context); + int i; set_option (OPTFORCEREDRAWINDEX); + /* force re-caching of index colors */ + for (i = 0; Context && i < Context->msgcount; i++) + Context->hdrs[i]->pair = 0; } return (0); } @@ -504,6 +507,8 @@ add_pattern (COLOR_LINE **top, const char *s, int sensitive, #endif if (is_index) { + int i; + strfcpy(buf, tmp->pattern, sizeof(buf)); mutt_check_simple (buf, sizeof (buf), NONULL(SimpleSearch)); if((tmp->color_pattern = mutt_pattern_comp (buf, M_FULL_MSG, err)) == NULL) @@ -511,6 +516,9 @@ add_pattern (COLOR_LINE **top, const char *s, int sensitive, mutt_free_color_line(&tmp, 1); return -1; } + /* force re-caching of index colors */ + for (i = 0; Context && i < Context->msgcount; i++) + Context->hdrs[i]->pair = 0; } tmp->pair = attr; *top = tmp; @@ -696,7 +704,6 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, else if (object == MT_COLOR_INDEX) { r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1); - mutt_cache_index_colors(Context); set_option (OPTFORCEREDRAWINDEX); } else if (object == MT_COLOR_QUOTED) diff --git a/curs_main.c b/curs_main.c index 95825911..a5729186 100644 --- a/curs_main.c +++ b/curs_main.c @@ -138,7 +138,13 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) int index_color (int index_no) { - return Context->hdrs[Context->v2r[index_no]]->pair; + HEADER *h = Context->hdrs[Context->v2r[index_no]]; + + if (h->pair) + return h->pair; + + mutt_set_header_color (Context, h); + return h->pair; } static int ci_next_undeleted (int msgno) @@ -1730,12 +1736,3 @@ void mutt_set_header_color (CONTEXT *ctx, HEADER *curhdr) } curhdr->pair = ColorDefs[MT_COLOR_NORMAL]; } - -void mutt_cache_index_colors (CONTEXT *ctx) -{ - int i; - - if (ctx) - for (i = 0; i < ctx->msgcount; i++) - mutt_set_header_color (ctx, ctx->hdrs[i]); -} @@ -273,7 +273,6 @@ int mutt_write_mime_body (BODY *, FILE *); int mutt_write_mime_header (BODY *, FILE *); int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int); int mutt_yesorno (const char *, int); -void mutt_cache_index_colors(CONTEXT *); void mutt_set_header_color(CONTEXT *, HEADER *); int mutt_save_confirm (const char *, struct stat *); @@ -54,7 +54,9 @@ void mutt_check_rescore (CONTEXT *ctx) for (i = 0; i < ctx->msgcount; i++) mutt_score_message (ctx->hdrs[i]); - mutt_cache_index_colors (ctx); + /* force re-caching of index colors */ + for (i = 0; ctx && i < ctx->msgcount; i++) + ctx->hdrs[i]->pair = 0; unset_option (OPTNEEDRESCORE); } @@ -255,8 +255,6 @@ void mutt_sort_headers (CONTEXT *ctx, int init) cur->collapsed = 0; } - mutt_cache_index_colors(ctx); - if (!ctx->quiet) mutt_clear_error (); } |