aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMatthew Kilgore <mattkilgore12@gmail.com>2019-10-03 23:53:38 -0400
committerGerd Hoffmann <kraxel@redhat.com>2019-10-18 10:39:12 +0200
commit30f5a9dd7a6252d31fb73ab5193f3be1be7766c7 (patch)
treee0ba4616343af4d351d18730ce19ca98cd61bbdd /ui
parentcd54ea456dbb2c704e8eb88c8ef4d3316aec133b (diff)
curses: correctly pass the color pair to setcchar()
The current code does not correctly pass the color pair information to setcchar(), it instead always passes zero. This results in the curses output always being in white on black. This patch fixes this by using PAIR_NUMBER() to retrieve the color pair number from the chtype value, and then passes that value as an argument to setcchar(). Signed-off-by: Matthew Kilgore <mattkilgore12@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Tested-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20191004035338.25601-3-mattkilgore12@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/curses.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/curses.c b/ui/curses.c
index 84003f56a3..3a1b71451c 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -77,12 +77,14 @@ static void curses_update(DisplayChangeListener *dcl,
for (x = 0; x < width; x++) {
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);
}