diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2015-10-19 21:23:10 +0900 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2015-11-03 10:12:45 +0100 |
commit | 615220ddaf23db4c5686053257c568b46967e4b5 (patch) | |
tree | 64b70925697c9aee0896cc81c3986679bbd16e67 | |
parent | 3d861a01093f8eedfac9889746ccafcfd32039b7 (diff) |
ui/curses: Fix monitor color with -curses when 256 colors
If TERM=xterm-256color, COLOR_PAIRS==256 and monitor passes chtype
like 0x74xx. Then, the code uses uninitialized color pair. As result,
monitor uses black for both of fg and bg color, i.e. terminal is
filled by black.
To fix, this initialize above than 64 with default color (fg=white,bg=black).
FIXME: on 256 color, curses may be possible better vga color emulation.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | ui/curses.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/curses.c b/ui/curses.c index 8edb038bb3..35edd5e1d2 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -341,8 +341,13 @@ static void curses_setup(void) nodelay(stdscr, TRUE); nonl(); keypad(stdscr, TRUE); start_color(); raw(); scrollok(stdscr, FALSE); - for (i = 0; i < 64; i ++) + for (i = 0; i < 64; i++) { init_pair(i, colour_default[i & 7], colour_default[i >> 3]); + } + /* Set default color for more than 64. (monitor uses 0x74xx for example) */ + for (i = 64; i < COLOR_PAIRS; i++) { + init_pair(i, COLOR_WHITE, COLOR_BLACK); + } } static void curses_keyboard_setup(void) |