Skip to content
Snippets Groups Projects
Commit 30f5a9dd authored by Matthew Kilgore's avatar Matthew Kilgore Committed by Gerd Hoffmann
Browse files

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: default avatarMatthew Kilgore <mattkilgore12@gmail.com>
Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Message-id: 20191004035338.25601-3-mattkilgore12@gmail.com
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent cd54ea45
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment