From e6f0a6b2a4ae53763edbad625e0f9b1158bb348d Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 27 Sep 2019 13:49:29 +0100 Subject: [PATCH] refactor: SET_COLOR() to mutt_curses_set_color() Encapsulate a curses function to reduce dependencies. --- Makefile.autosetup | 2 +- compose.c | 36 ++++++++++++++++----------------- curs_lib.c | 14 ++++++------- index.c | 2 +- menu.c | 14 ++++++------- mutt_curses.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ mutt_curses.h | 22 ++------------------ mutt_logging.c | 2 +- pager.c | 10 +++++----- progress.c | 4 ++-- remailer.c | 4 ++-- sidebar.c | 16 +++++++-------- 12 files changed, 104 insertions(+), 72 deletions(-) create mode 100644 mutt_curses.c diff --git a/Makefile.autosetup b/Makefile.autosetup index 359b32119..4b866b374 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -66,7 +66,7 @@ NEOMUTTOBJS= addrbook.o alias.o bcache.o browser.o color.o commands.o \ curs_lib.o edit.o editmsg.o enriched.o enter.o filter.o flags.o \ git_ver.o handler.o hdrline.o help.o hook.o icommands.o index.o init.o \ keymap.o mailcap.o main.o menu.o mutt_account.o mutt_attach.o \ - mutt_body.o mutt_header.o mutt_history.o mutt_logging.o mutt_mailbox.o \ + mutt_body.o mutt_curses.o mutt_header.o mutt_history.o mutt_logging.o mutt_mailbox.o \ mutt_parse.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o \ muttlib.o mx.o myvar.o pager.o pattern.o postpone.o progress.o query.o \ recvattach.o recvcmd.o resize.o rfc3676.o score.o send.o sendlib.o \ diff --git a/compose.c b/compose.c index a806792c5..dd46652e3 100644 --- a/compose.c +++ b/compose.c @@ -370,7 +370,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) { struct Email *e = rd->email; - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_CRYPT, 0, "%*s", HeaderPadding[HDR_CRYPT], _(Prompts[HDR_CRYPT])); NORMAL_COLOR; @@ -383,23 +383,23 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN)) { - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_BOTH); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_BOTH); addstr(_("Sign, Encrypt")); } else if (e->security & SEC_ENCRYPT) { - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_ENCRYPT); addstr(_("Encrypt")); } else if (e->security & SEC_SIGN) { - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_SIGN); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_SIGN); addstr(_("Sign")); } else { /* L10N: This refers to the encryption of the email, e.g. "Security: None" */ - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_NONE); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_NONE); addstr(_("None")); } NORMAL_COLOR; @@ -427,7 +427,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP) && (e->security & SEC_SIGN)) { - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO])); NORMAL_COLOR; printw("%s", C_PgpSignAs ? C_PgpSignAs : _("")); @@ -436,7 +436,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) && (e->security & SEC_SIGN)) { - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO])); NORMAL_COLOR; printw("%s", C_SmimeSignAs ? C_SmimeSignAs : _("")); @@ -445,7 +445,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) && (e->security & SEC_ENCRYPT) && C_SmimeEncryptWith) { - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_CRYPTINFO, 40, "%s", _("Encrypt with: ")); NORMAL_COLOR; printw("%s", NONULL(C_SmimeEncryptWith)); @@ -456,21 +456,21 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd) mutt_window_clrtoeol(rd->win); if (C_Autocrypt) { - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); printw("%*s", HeaderPadding[HDR_AUTOCRYPT], _(Prompts[HDR_AUTOCRYPT])); NORMAL_COLOR; if (e->security & SEC_AUTOCRYPT) { - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_ENCRYPT); addstr(_("Encrypt")); } else { - SET_COLOR(MT_COLOR_COMPOSE_SECURITY_NONE); + mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_NONE); addstr(_("Off")); } - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_AUTOCRYPT, 40, "%s", /* L10N: The autocrypt compose menu Recommendation field. @@ -534,7 +534,7 @@ static void redraw_mix_line(struct ListHead *chain, struct ComposeRedrawData *rd { char *t = NULL; - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_MIX, 0, "%*s", HeaderPadding[HDR_MIX], _(Prompts[HDR_MIX])); NORMAL_COLOR; @@ -617,7 +617,7 @@ static void draw_envelope_addr(int line, struct AddressList *al, struct ComposeR buf[0] = '\0'; mutt_addrlist_write(buf, sizeof(buf), al, true); - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, line, 0, "%*s", HeaderPadding[line], _(Prompts[line])); NORMAL_COLOR; mutt_paddstr(W, buf); @@ -659,7 +659,7 @@ static void draw_envelope(struct ComposeRedrawData *rd) } #endif - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_SUBJECT, 0, "%*s", HeaderPadding[HDR_SUBJECT], _(Prompts[HDR_SUBJECT])); NORMAL_COLOR; @@ -667,7 +667,7 @@ static void draw_envelope(struct ComposeRedrawData *rd) draw_envelope_addr(HDR_REPLYTO, &e->env->reply_to, rd); - SET_COLOR(MT_COLOR_COMPOSE_HEADER); + mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER); mutt_window_mvprintw(rd->win, HDR_FCC, 0, "%*s", HeaderPadding[HDR_FCC], _(Prompts[HDR_FCC])); NORMAL_COLOR; @@ -680,7 +680,7 @@ static void draw_envelope(struct ComposeRedrawData *rd) redraw_mix_line(&e->chain, rd); #endif - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_window_mvaddstr(rd->win, HDR_ATTACH_TITLE, 0, _("-- Attachments")); mutt_window_clrtoeol(rd->win); @@ -866,7 +866,7 @@ static void compose_custom_redraw(struct Menu *menu) compose_status_line(buf, sizeof(buf), 0, menu->statuswin->cols, menu, NONULL(C_ComposeFormat)); mutt_window_move(menu->statuswin, 0, 0); - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_paddstr(menu->statuswin->cols, buf); NORMAL_COLOR; menu->redraw &= ~REDRAW_STATUS; diff --git a/curs_lib.c b/curs_lib.c index dbbf0c0eb..29e6a9742 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -262,7 +262,7 @@ int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionF mutt_menu_current_redraw(); } mutt_window_clearline(MuttMessageWindow, 0); - SET_COLOR(MT_COLOR_PROMPT); + mutt_curses_set_color(MT_COLOR_PROMPT); addstr(field); NORMAL_COLOR; mutt_refresh(); @@ -392,7 +392,7 @@ enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def) ((size_t) prompt_lines * MuttMessageWindow->cols) - answer_string_wid, NULL); mutt_window_move(MuttMessageWindow, 0, 0); - SET_COLOR(MT_COLOR_PROMPT); + mutt_curses_set_color(MT_COLOR_PROMPT); addnstr(msg, trunc_msg_len); addstr(answer_string); NORMAL_COLOR; @@ -488,7 +488,7 @@ void mutt_show_error(void) if (OptKeepQuiet || !ErrorBufMessage) return; - SET_COLOR(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); + mutt_curses_set_color(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf); NORMAL_COLOR; mutt_window_clrtoeol(MuttMessageWindow); @@ -656,7 +656,7 @@ int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, { struct KeyEvent ch; - SET_COLOR(MT_COLOR_PROMPT); + mutt_curses_set_color(MT_COLOR_PROMPT); mutt_window_mvaddstr(MuttMessageWindow, 0, 0, prompt); addstr(_(" ('?' for list): ")); NORMAL_COLOR; @@ -890,13 +890,13 @@ int mutt_multi_choice(const char *prompt, const char *letters) while ((cur = strchr(prompt, '('))) { // write the part between prompt and cur using MT_COLOR_PROMPT - SET_COLOR(MT_COLOR_PROMPT); + mutt_curses_set_color(MT_COLOR_PROMPT); addnstr(prompt, cur - prompt); if (isalnum(cur[1]) && (cur[2] == ')')) { // we have a single letter within parentheses - SET_COLOR(MT_COLOR_OPTIONS); + mutt_curses_set_color(MT_COLOR_OPTIONS); addch(cur[1]); prompt = cur + 3; } @@ -909,7 +909,7 @@ int mutt_multi_choice(const char *prompt, const char *letters) } } - SET_COLOR(MT_COLOR_PROMPT); + mutt_curses_set_color(MT_COLOR_PROMPT); addstr(prompt); NORMAL_COLOR; diff --git a/index.c b/index.c index 25f502074..6d32ca29d 100644 --- a/index.c +++ b/index.c @@ -1009,7 +1009,7 @@ static void index_custom_redraw(struct Menu *menu) char buf[1024]; menu_status_line(buf, sizeof(buf), menu, NONULL(C_StatusFormat)); mutt_window_move(menu->statuswin, 0, 0); - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_draw_statusline(menu->statuswin->cols, buf, sizeof(buf)); NORMAL_COLOR; menu->redraw &= ~REDRAW_STATUS; diff --git a/menu.c b/menu.c index 073f24e99..a5caa6753 100644 --- a/menu.c +++ b/menu.c @@ -158,7 +158,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, bool do * may be undefined. */ ATTR_SET(mutt_color_combine(ColorDefs[MT_COLOR_TREE], attr)); #else - SET_COLOR(MT_COLOR_TREE); + mutt_curses_set_color(MT_COLOR_TREE); #endif while (*s && (*s < MUTT_TREE_MAX)) @@ -367,7 +367,7 @@ void menu_redraw_full(struct Menu *menu) if (C_Help) { - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_window_move(MuttHelpWindow, 0, 0); mutt_paddstr(MuttHelpWindow->cols, menu->help); NORMAL_COLOR; @@ -392,7 +392,7 @@ void menu_redraw_status(struct Menu *menu) char buf[256]; snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title); - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_window_move(menu->statuswin, 0, 0); mutt_paddstr(menu->statuswin->cols, buf); NORMAL_COLOR; @@ -436,7 +436,7 @@ void menu_redraw_index(struct Menu *menu) if (i == menu->current) { - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); if (C_ArrowCursor) { addstr("->"); @@ -497,7 +497,7 @@ void menu_redraw_motion(struct Menu *menu) } /* now draw it in the new location */ - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); mutt_window_mvaddstr(menu->indexwin, menu->current + menu->offset - menu->top, 0, "->"); } else @@ -511,7 +511,7 @@ void menu_redraw_motion(struct Menu *menu) const int cur_color = menu->menu_color(menu->current); menu_make_entry(buf, sizeof(buf), menu, menu->current); menu_pad_string(menu, buf, sizeof(buf)); - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); mutt_window_move(menu->indexwin, menu->current + menu->offset - menu->top, 0); print_enriched_string(menu->current, cur_color, (unsigned char *) buf, false); } @@ -532,7 +532,7 @@ void menu_redraw_current(struct Menu *menu) menu_make_entry(buf, sizeof(buf), menu, menu->current); menu_pad_string(menu, buf, sizeof(buf)); - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); if (C_ArrowCursor) { addstr("->"); diff --git a/mutt_curses.c b/mutt_curses.c new file mode 100644 index 000000000..12146455a --- /dev/null +++ b/mutt_curses.c @@ -0,0 +1,50 @@ +/** + * @file + * Define wrapper functions around Curses/Slang + * + * @authors + * Copyright (C) 1996-2000,2012 Michael R. Elkins + * Copyright (C) 2004 g10 Code GmbH + * Copyright (C) 2019 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "config.h" +#include "mutt_curses.h" +#include "color.h" + +/** + * mutt_curses_set_color - Set the current colour for text + * @param color Colour to set, e.g. #MT_COLOR_HEADER + * + * If the system has bkgdset() use it rather than attrset() so that the clr*() + * functions will properly set the background attributes all the way to the + * right column. + */ +void mutt_curses_set_color(enum ColorId color) +{ +#ifdef HAVE_BKGDSET + if (ColorDefs[color] != 0) + bkgdset(ColorDefs[color] | ' '); + else + bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' '); +#else + if (ColorDefs[color] != 0) + attrset(ColorDefs[color]); + else + attrset(ColorDefs[MT_COLOR_NORMAL]); +#endif +} diff --git a/mutt_curses.h b/mutt_curses.h index b6a893f41..7ba196586 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -26,6 +26,7 @@ #include "config.h" #include +#include "color.h" #ifdef USE_SLANG_CURSES @@ -101,31 +102,12 @@ void mutt_curs_set(int cursor); #define CI_is_return(ch) (((ch) == '\r') || ((ch) == '\n')) #endif +void mutt_curses_set_color(enum ColorId color); void mutt_resize_screen(void); -/* If the system has bkgdset() use it rather than attrset() so that the clr*() - * functions will properly set the background attributes all the way to the - * right column. - */ #ifdef HAVE_BKGDSET -#define SET_COLOR(X) \ - do \ - { \ - if (ColorDefs[X] != 0) \ - bkgdset(ColorDefs[X] | ' '); \ - else \ - bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' '); \ - } while (false) #define ATTR_SET(X) bkgdset(X | ' ') #else -#define SET_COLOR(X) \ - do \ - { \ - if (ColorDefs[X] != 0) \ - attrset(ColorDefs[X]); \ - else \ - attrset(ColorDefs[MT_COLOR_NORMAL]); \ - } while (false) #define ATTR_SET attrset #endif diff --git a/mutt_logging.c b/mutt_logging.c index e4e0ee910..ba9b88be8 100644 --- a/mutt_logging.c +++ b/mutt_logging.c @@ -172,7 +172,7 @@ int log_disp_curses(time_t stamp, const char *file, int line, { if (level == LL_ERROR) BEEP(); - SET_COLOR((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); + mutt_curses_set_color((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf); NORMAL_COLOR; mutt_window_clrtoeol(MuttMessageWindow); diff --git a/pager.c b/pager.c index 3afa3ab79..c9c746e4b 100644 --- a/pager.c +++ b/pager.c @@ -376,7 +376,7 @@ static void resolve_color(struct Line *line_info, int n, int cnt, { if (!cnt && C_Markers) { - SET_COLOR(MT_COLOR_MARKERS); + mutt_curses_set_color(MT_COLOR_MARKERS); addch('+'); last_color = ColorDefs[MT_COLOR_MARKERS]; } @@ -1991,7 +1991,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) if (C_Help) { - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_window_move(MuttHelpWindow, 0, 0); mutt_paddstr(MuttHelpWindow->cols, rd->helpstr); NORMAL_COLOR; @@ -2134,7 +2134,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) rd->last_offset = rd->line_info[rd->curline].offset; } while (rd->force_redraw); - SET_COLOR(MT_COLOR_TILDE); + mutt_curses_set_color(MT_COLOR_TILDE); while (rd->lines < rd->pager_window->rows) { mutt_window_clrtoeol(rd->pager_window); @@ -2177,7 +2177,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) /* print out the pager status bar */ mutt_window_move(rd->pager_status_window, 0, 0); - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); if (IsEmail(rd->extra) || IsMsgAttach(rd->extra)) { @@ -2215,7 +2215,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) menu_status_line(buf, sizeof(buf), rd->menu, NONULL(C_StatusFormat)); mutt_window_move(rd->index_status_window, 0, 0); - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_draw_statusline(rd->index_status_window->cols, buf, sizeof(buf)); NORMAL_COLOR; } diff --git a/progress.c b/progress.c index 9f41eccdb..d86fa8520 100644 --- a/progress.c +++ b/progress.c @@ -81,7 +81,7 @@ static void message_bar(int percent, const char *fmt, ...) if (l < w) { /* The string fits within the colour bar */ - SET_COLOR(MT_COLOR_PROGRESS); + mutt_curses_set_color(MT_COLOR_PROGRESS); addstr(buf2); w -= l; while (w-- > 0) @@ -97,7 +97,7 @@ static void message_bar(int percent, const char *fmt, ...) char ch = buf2[off]; buf2[off] = '\0'; - SET_COLOR(MT_COLOR_PROGRESS); + mutt_curses_set_color(MT_COLOR_PROGRESS); addstr(buf2); buf2[off] = ch; NORMAL_COLOR; diff --git a/remailer.c b/remailer.c index 3bc71617f..0cb794d6b 100644 --- a/remailer.c +++ b/remailer.c @@ -331,7 +331,7 @@ static void mix_redraw_ce(struct Remailer **type2_list, struct Coord *coords, if (coords[i].r < MIX_MAXROW) { if (selected) - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); else NORMAL_COLOR; @@ -370,7 +370,7 @@ static void mix_redraw_chain(struct Remailer **type2_list, struct Coord *coords, */ static void mix_redraw_head(struct MixChain *chain) { - SET_COLOR(MT_COLOR_STATUS); + mutt_curses_set_color(MT_COLOR_STATUS); mutt_window_mvprintw(MuttIndexWindow, MIX_VOFFSET - 1, 0, "-- Remailer chain [Length: %d]", chain ? chain->cl : 0); mutt_window_clrtoeol(MuttIndexWindow); diff --git a/sidebar.c b/sidebar.c index 8aae4593b..8b2ae9e9c 100644 --- a/sidebar.c +++ b/sidebar.c @@ -747,7 +747,7 @@ static int draw_divider(int num_rows, int num_cols) if (delim_len > num_cols) return 0; - SET_COLOR(MT_COLOR_DIVIDER); + mutt_curses_set_color(MT_COLOR_DIVIDER); int col = C_SidebarOnRight ? 0 : (C_SidebarWidth - delim_len); @@ -836,25 +836,25 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) if (entryidx == OpnIndex) { if ((ColorDefs[MT_COLOR_SB_INDICATOR] != 0)) - SET_COLOR(MT_COLOR_SB_INDICATOR); + mutt_curses_set_color(MT_COLOR_SB_INDICATOR); else - SET_COLOR(MT_COLOR_INDICATOR); + mutt_curses_set_color(MT_COLOR_INDICATOR); } else if (entryidx == HilIndex) - SET_COLOR(MT_COLOR_HIGHLIGHT); + mutt_curses_set_color(MT_COLOR_HIGHLIGHT); else if ((m->msg_unread > 0) || (m->has_new)) - SET_COLOR(MT_COLOR_NEW); + mutt_curses_set_color(MT_COLOR_NEW); else if (m->msg_flagged > 0) - SET_COLOR(MT_COLOR_FLAGGED); + mutt_curses_set_color(MT_COLOR_FLAGGED); else if ((ColorDefs[MT_COLOR_SB_SPOOLFILE] != 0) && (mutt_str_strcmp(mailbox_path(m), C_Spoolfile) == 0)) { - SET_COLOR(MT_COLOR_SB_SPOOLFILE); + mutt_curses_set_color(MT_COLOR_SB_SPOOLFILE); } else { if (ColorDefs[MT_COLOR_ORDINARY] != 0) - SET_COLOR(MT_COLOR_ORDINARY); + mutt_curses_set_color(MT_COLOR_ORDINARY); else NORMAL_COLOR; } -- 2.40.0