From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo9TB-0000Wk-Fa for qemu-devel@nongnu.org; Mon, 19 Oct 2015 08:23:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo9T6-0000z5-Tc for qemu-devel@nongnu.org; Mon, 19 Oct 2015 08:23:16 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:48798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo9T6-0000ys-L3 for qemu-devel@nongnu.org; Mon, 19 Oct 2015 08:23:12 -0400 From: OGAWA Hirofumi Date: Mon, 19 Oct 2015 21:23:10 +0900 Message-ID: <87a8rft5ch.fsf@mail.parknet.co.jp> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v2 1/3] ui/curses: Fix monitor color with -curses when 256 colors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org 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 --- ui/curses.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff -puN ui/curses.c~support-curses-256color ui/curses.c --- qemu/ui/curses.c~support-curses-256color 2015-10-14 20:12:06.311051365 +0900 +++ qemu-hirofumi/ui/curses.c 2015-10-19 21:16:24.595994457 +0900 @@ -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) _