From c7c9727e0cc06ed6a3d2313b82546ed747148424 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 15 Dec 2017 14:23:36 +0000 Subject: [PATCH] identical code for different branches `SETCOLOR(MT_COLOR_NORMAL)` caused identical code to be generated in both branches of an `if` statement. --- curs_lib.c | 4 ++-- main.c | 2 +- mutt_curses.h | 6 +++++- sidebar.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/curs_lib.c b/curs_lib.c index 4c7806917..2737381fd 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -525,7 +525,7 @@ static void message_bar(int percent, const char *fmt, ...) { addch(' '); } - SETCOLOR(MT_COLOR_NORMAL); + NORMAL_COLOR; } else { @@ -538,7 +538,7 @@ static void message_bar(int percent, const char *fmt, ...) SETCOLOR(MT_COLOR_PROGRESS); addstr(buf2); buf2[off] = ch; - SETCOLOR(MT_COLOR_NORMAL); + NORMAL_COLOR; addstr(&buf2[off]); } } diff --git a/main.c b/main.c index 745c4f774..8079de446 100644 --- a/main.c +++ b/main.c @@ -503,7 +503,7 @@ int main(int argc, char **argv, char **env) if (!option(OPT_NO_CURSES)) { - SETCOLOR(MT_COLOR_NORMAL); + NORMAL_COLOR; clear(); mutt_error = mutt_curses_error; mutt_message = mutt_curses_message; diff --git a/mutt_curses.h b/mutt_curses.h index 83cc779b6..eb6af86e7 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -309,6 +309,10 @@ void ci_start_color(void); #endif /* reset the color to the normal terminal color as defined by 'color normal ...' */ -#define NORMAL_COLOR SETCOLOR(MT_COLOR_NORMAL) +#ifdef HAVE_BKGDSET +#define NORMAL_COLOR bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' ') +#else +#define NORMAL_COLOR attrset(ColorDefs[MT_COLOR_NORMAL]) +#endif #endif /* _MUTT_CURSES_H */ diff --git a/sidebar.c b/sidebar.c index 2a286f08f..436943e9b 100644 --- a/sidebar.c +++ b/sidebar.c @@ -776,7 +776,7 @@ static int draw_divider(int num_rows, int num_cols) static void fill_empty_space(int first_row, int num_rows, int div_width, int num_cols) { /* Fill the remaining rows with blank space */ - SETCOLOR(MT_COLOR_NORMAL); + NORMAL_COLOR; if (!option(OPT_SIDEBAR_ON_RIGHT)) div_width = 0; @@ -849,7 +849,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) if (ColorDefs[MT_COLOR_ORDINARY] != 0) SETCOLOR(MT_COLOR_ORDINARY); else - SETCOLOR(MT_COLOR_NORMAL); + NORMAL_COLOR; } int col = 0; -- 2.40.0