Do the windows ANSI color fix properly
This commit is contained in:
parent
b64ca1c07c
commit
f69062f68e
1 changed files with 6 additions and 5 deletions
11
chat.cpp
11
chat.cpp
|
@ -887,11 +887,12 @@ int main(int argc, char ** argv) {
|
||||||
sigaction(SIGINT, &sigint_action, NULL);
|
sigaction(SIGINT, &sigint_action, NULL);
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
signal(SIGINT, sigint_handler);
|
signal(SIGINT, sigint_handler);
|
||||||
//Windows console ANSI color fix
|
|
||||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
// Windows console ANSI color fix
|
||||||
DWORD mode;
|
DWORD mode;
|
||||||
GetConsoleMode(hConsole, &mode);
|
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
if (hConsole && hConsole != INVALID_HANDLE_VALUE && GetConsoleMode(hConsole, &mode))
|
||||||
|
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "%s: interactive mode on.\n", __func__);
|
fprintf(stderr, "%s: interactive mode on.\n", __func__);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue