Browse Source

Add workaround for linux virtual console colors init error

master
cancel 6 years ago
parent
commit
b5642ac35e
  1. 32
      tui_main.c

32
tui_main.c

@ -1585,18 +1585,26 @@ int main(int argc, char** argv) {
// hasn't typed anything. That way we can mix other timers in our code, // hasn't typed anything. That way we can mix other timers in our code,
// instead of being a slave only to terminal input. // instead of being a slave only to terminal input.
// nodelay(stdscr, TRUE); // nodelay(stdscr, TRUE);
// Enable color
start_color(); if (has_colors()) {
use_default_colors(); // Enable color
start_color();
for (int ifg = 0; ifg < Colors_count; ++ifg) { use_default_colors();
for (int ibg = 0; ibg < Colors_count; ++ibg) { for (int ifg = 0; ifg < Colors_count; ++ifg) {
int res = init_pair((short int)(1 + ifg * Colors_count + ibg), for (int ibg = 0; ibg < Colors_count; ++ibg) {
(short int)(ifg - 1), (short int)(ibg - 1)); int res = init_pair((short int)(1 + ifg * Colors_count + ibg),
if (res == ERR) { (short int)(ifg - 1), (short int)(ibg - 1));
endwin(); (void)res;
fprintf(stderr, "Error initializing color\n"); // Might fail on Linux virtual console/terminal for a couple of colors.
exit(1); // Just ignore.
#if 0
if (res == ERR) {
endwin();
fprintf(stderr, "Error initializing color pair: %d %d\n", ifg - 1,
ibg - 1);
exit(1);
}
#endif
} }
} }
} }

Loading…
Cancel
Save