Early escape in text_color_init

This commit is contained in:
Daniel M. Weeks 2016-01-26 11:33:44 -05:00
parent 87d9fe00b8
commit bce03cdf2f
1 changed files with 20 additions and 22 deletions

View File

@ -207,37 +207,35 @@ void text_color_init (int enable_color)
g_enable_color = enable_color;
if (g_enable_color == 0) {
return;
}
#if __WIN32__
if (g_enable_color) {
HANDLE h;
CONSOLE_SCREEN_BUFFER_INFO csbi;
WORD attr = BACKGROUND_WHITE;
DWORD length;
COORD coord;
DWORD nwritten;
HANDLE h;
CONSOLE_SCREEN_BUFFER_INFO csbi;
WORD attr = BACKGROUND_WHITE;
DWORD length;
COORD coord;
DWORD nwritten;
h = GetStdHandle(STD_OUTPUT_HANDLE);
if (h != NULL && h != INVALID_HANDLE_VALUE) {
h = GetStdHandle(STD_OUTPUT_HANDLE);
if (h != NULL && h != INVALID_HANDLE_VALUE) {
GetConsoleScreenBufferInfo (h, &csbi);
GetConsoleScreenBufferInfo (h, &csbi);
length = csbi.dwSize.X * csbi.dwSize.Y;
coord.X = 0;
coord.Y = 0;
FillConsoleOutputAttribute (h, attr, length, coord, &nwritten);
}
length = csbi.dwSize.X * csbi.dwSize.Y;
coord.X = 0;
coord.Y = 0;
FillConsoleOutputAttribute (h, attr, length, coord, &nwritten);
}
#else
if (g_enable_color) {
//printf ("%s", clear_eos);
printf ("%s", background_white);
printf ("%s", clear_eos);
printf ("%s", black);
}
//printf ("%s", clear_eos);
printf ("%s", background_white);
printf ("%s", clear_eos);
printf ("%s", black);
#endif
}