From: Pierre Habouzit Date: Sat, 29 Dec 2007 18:27:48 +0000 (+0100) Subject: Fixes wrt default colors use. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=db8ff78290e27a9978b51865ab40d30e78469ed5;p=apps%2Fmadtty.git Fixes wrt default colors use. Signed-off-by: Pierre Habouzit --- diff --git a/madtty/madtty.c b/madtty/madtty.c index e7f26f8..ef1230b 100644 --- a/madtty/madtty.c +++ b/madtty/madtty.c @@ -127,16 +127,26 @@ static char const * const keytable[KEY_MAX+1] = { [KEY_PPAGE] = "\e[5~", [KEY_NPAGE] = "\e[6~", [KEY_SUSPEND] = "\x1A", /* Ctrl+Z gets mapped to this */ - [KEY_F(1)] = "\e[[A", - [KEY_F(2)] = "\e[[B", - [KEY_F(3)] = "\e[[C", - [KEY_F(4)] = "\e[[D", - [KEY_F(5)] = "\e[[E", + [KEY_F(1)] = "\e[11~", + [KEY_F(2)] = "\e[12~", + [KEY_F(3)] = "\e[13~", + [KEY_F(4)] = "\e[14~", + [KEY_F(5)] = "\e[15~", [KEY_F(6)] = "\e[17~", [KEY_F(7)] = "\e[18~", [KEY_F(8)] = "\e[19~", [KEY_F(9)] = "\e[20~", [KEY_F(10)] = "\e[21~", + [KEY_F(11)] = "\e[23~", + [KEY_F(12)] = "\e[24~", + [KEY_F(13)] = "\e[25~", + [KEY_F(14)] = "\e[26~", + [KEY_F(15)] = "\e[28~", + [KEY_F(16)] = "\e[29~", + [KEY_F(17)] = "\e[31~", + [KEY_F(18)] = "\e[32~", + [KEY_F(19)] = "\e[33~", + [KEY_F(20)] = "\e[34~", }; static void t_row_set(t_row_t *row, int start, int len, uint16_t attr) @@ -1038,7 +1048,6 @@ void madtty_init_colors(void) { if (COLOR_PAIRS > 64) { use_default_colors(); - assume_default_colors(-1, -1); has_default = 1; for (int bg = -1; bg < 8; bg++) { @@ -1047,12 +1056,19 @@ void madtty_init_colors(void) } } } else { + int use_default = use_default_colors() == OK; for (int bg = 0; bg < 8; bg++) { for (int fg = 0; fg < 8; fg++) { + if (use_default) { + init_pair((7 - fg) * 8 + bg, + fg == COLOR_WHITE ? -1 : fg, + bg == COLOR_BLACK ? -1 : bg); + } else { init_pair((7 - fg) * 8 + bg, fg, bg); } } } + } } int madtty_color_pair(int fg, int bg)