$OpenBSD: patch-src_colors_cxx,v 1.1 2018/07/04 09:02:58 landry Exp $


"Fix" screen corruption in ncmpc. Colors and attributes can not be mixed.
Colors are in the low 8 bit, mask them in the appropriate places.

Index: src/colors.cxx
--- src/colors.cxx.orig
+++ src/colors.cxx
@@ -99,7 +99,7 @@ colors_update_pair(enum color id)
 {
 	assert(id > 0 && id < COLOR_END);
 
-	int fg = colors[id].color;
+	int fg = colors[id].color & 0xff;
 	int bg = colors[COLOR_BACKGROUND].color;
 
 	/* If color == COLOR_NONE (negative),
@@ -257,7 +257,7 @@ colors_use(WINDOW *w, enum color id)
 	if (options.enable_colors) {
 		/* color mode */
 		if ((int)attrs != entry->color || (short)id != pair)
-			wattr_set(w, entry->color, id, nullptr);
+			wattr_set(w, entry->color & 0xff, id, nullptr);
 	} else {
 #endif
 		/* mono mode */
