static int fg_col;
static int bg_col;
+
+static void reset_ansi(void)
+{
+ attributes = A_NORMAL;
+ fg_col = 0;
+ bg_col = 0;
+}
+
static void init_ansi_colors(void)
{
short ncurses_colors[] = {
- COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE,
- COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
+ -1, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
+ COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
};
nr_of_colors = sizeof(ncurses_colors) / sizeof(short);
for (bg_col = 0; bg_col < nr_of_colors; bg_col++)
for (fg_col = 0; fg_col < nr_of_colors; fg_col++)
init_pair(bg_col * nr_of_colors + fg_col + 1, ncurses_colors[fg_col], ncurses_colors[bg_col]);
-
- /* default settings */
- attributes = A_NORMAL;
- fg_col = COLOR_WHITE;
- bg_col = COLOR_BLACK;
+ reset_ansi();
}
case -1: /* restore last settings */
break;
case 0: /* restore default settings */
- attributes = A_NORMAL;
- fg_col = COLOR_WHITE;
- bg_col = COLOR_BLACK;
+ reset_ansi();
break;
case 1: /* set bold / increased intensity */
attributes |= A_BOLD;
break;
default:
if (attrib >= 30 && attrib <= 37) { /* set foreground color */
- fg_col = attrib - 30;
+ fg_col = attrib - 30 + 1;
} else if (attrib >= 40 && attrib <= 47) { /* set background color */
- bg_col = attrib - 40;
+ bg_col = attrib - 40 + 1;
}
}
if ((p = fdopen(pipefd[0], "r")) == NULL)
xerr(5, _("fdopen"));
+ reset_ansi();
for (y = show_title; y < height; y++) {
int eolseen = 0, tabpending = 0, tabwaspending;
set_ansi_attribute(-1);