From 92e431cdf3df57b62aa90020757623637701482a Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 5 Jun 2017 13:51:22 +0100 Subject: [PATCH] fix: Don't set a colour unless it's been defined. Some SETCOLOR's were being used without checking if the user had set the colour, first. If the user set the "normal" colours, then SETCOLOR would leave blocks of unexpected colours. Fixes #610 --- mutt_curses.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mutt_curses.h b/mutt_curses.h index 51bfdb294..22525fc38 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -273,10 +273,20 @@ void ci_start_color(void); * right column. */ #ifdef HAVE_BKGDSET -#define SETCOLOR(X) bkgdset(ColorDefs[X] | ' ') +#define SETCOLOR(X) \ + do \ + { \ + if (ColorDefs[X] != 0) \ + bkgdset(ColorDefs[X] | ' '); \ + } while (0) #define ATTRSET(X) bkgdset(X | ' ') #else -#define SETCOLOR(X) attrset(ColorDefs[X]) +#define SETCOLOR(X) \ + do \ + { \ + if (ColorDefs[X] != 0) \ + attrset(ColorDefs[X]); \ + } while (0) #define ATTRSET attrset #endif -- 2.40.0