The first point is not that big of a deal, the 0xff mask is very likely
to be correct. The second issue however results in colors no longer
working when using the curses display, instead the text will always be
white on black.
This patch fixes the color issue by using PAIR_NUMBER() to retrieve the
color pair number from the chtype value, and then passes that number to
setcchar.
Signed-off-by: Matthew Kilgore <address@hidden>
---
ui/curses.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ui/curses.c b/ui/curses.c
index ec281125acbd..3a1b71451c93 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -75,14 +75,16 @@ static void curses_update(DisplayChangeListener *dcl,
line = screen + y * width;
for (h += y; y < h; y ++, line += width) {
for (x = 0; x < width; x++) {
- chtype ch = line[x] & 0xff;
- chtype at = line[x] & ~0xff;
+ chtype ch = line[x] & A_CHARTEXT;
+ chtype at = line[x] & A_ATTRIBUTES;
+ short color_pair = PAIR_NUMBER(line[x]);
+
ret = getcchar(&vga_to_curses[ch], wch, &attrs, &colors, NULL);
if (ret == ERR || wch[0] == 0) {
wch[0] = ch;
wch[1] = 0;
}
- setcchar(&curses_line[x], wch, at, 0, NULL);
+ setcchar(&curses_line[x], wch, at, color_pair, NULL);
}
mvwadd_wchnstr(screenpad, y, 0, curses_line, width);
}