Browse Source

Add workaround for linux virtual console colors init error

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

12
tui_main.c

@ -1585,19 +1585,27 @@ 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);
if (has_colors()) {
// Enable color // Enable color
start_color(); start_color();
use_default_colors(); use_default_colors();
for (int ifg = 0; ifg < Colors_count; ++ifg) { for (int ifg = 0; ifg < Colors_count; ++ifg) {
for (int ibg = 0; ibg < Colors_count; ++ibg) { for (int ibg = 0; ibg < Colors_count; ++ibg) {
int res = init_pair((short int)(1 + ifg * Colors_count + ibg), int res = init_pair((short int)(1 + ifg * Colors_count + ibg),
(short int)(ifg - 1), (short int)(ibg - 1)); (short int)(ifg - 1), (short int)(ibg - 1));
(void)res;
// Might fail on Linux virtual console/terminal for a couple of colors.
// Just ignore.
#if 0
if (res == ERR) { if (res == ERR) {
endwin(); endwin();
fprintf(stderr, "Error initializing color\n"); fprintf(stderr, "Error initializing color pair: %d %d\n", ifg - 1,
ibg - 1);
exit(1); exit(1);
} }
#endif
}
} }
} }

Loading…
Cancel
Save