From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKMP-0003uJ-El for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmKML-0003mQ-8G for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:45 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:48002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKMK-0003mL-Vc for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:36:41 -0400 Received: from ibmpc.myhome.or.jp (unknown [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTP id 4D7641E0049 for ; Wed, 14 Oct 2015 20:36:40 +0900 (JST) Received: from devron.myhome.or.jp (root@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.14.9/8.14.9/Debian-4) with ESMTP id t9EBadox007985 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Oct 2015 20:36:40 +0900 Received: from devron.myhome.or.jp (hirofumi@localhost [127.0.0.1]) by devron.myhome.or.jp (8.14.9/8.14.9/Debian-4) with ESMTP id t9EBacHJ021745 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Oct 2015 20:36:39 +0900 From: OGAWA Hirofumi References: <87k2qp8yxv.fsf@mail.parknet.co.jp> Date: Wed, 14 Oct 2015 20:36:38 +0900 In-Reply-To: <87k2qp8yxv.fsf@mail.parknet.co.jp> (OGAWA Hirofumi's message of "Wed, 14 Oct 2015 20:35:56 +0900") Message-ID: <87fv1d8ywp.fsf@mail.parknet.co.jp> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 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: 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 | 3 +++ 1 file changed, 3 insertions(+) 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-14 20:27:39.417674271 +0900 @@ -343,6 +343,9 @@ static void curses_setup(void) 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) _