]> granicus.if.org Git - neomutt/commitdiff
fix: Don't set a colour unless it's been defined. 615/head
authorRichard Russon <rich@flatcap.org>
Mon, 5 Jun 2017 12:51:22 +0000 (13:51 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 7 Jun 2017 21:59:43 +0000 (22:59 +0100)
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

index 51bfdb294b768ff672fe62e137aed1f587c06e5a..22525fc38e0aae99c34b59a1917a5f0bd97a954e 100644 (file)
@@ -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