mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Enable escape sequence on Windows10 console
* win32/win32.c (init_stdhandle): enable escape sequence on Windows10 console to show `ruby --help` colors correctly.
This commit is contained in:
parent
95ce5c0ee9
commit
09f939d3a0
1 changed files with 11 additions and 0 deletions
|
@ -2687,6 +2687,17 @@ init_stdhandle(void)
|
|||
}
|
||||
if (nullfd >= 0 && !keep) close(nullfd);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
{
|
||||
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
DWORD m;
|
||||
if (GetConsoleMode(h, &m)) {
|
||||
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x200
|
||||
#endif
|
||||
SetConsoleMode(h, m | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef getsockopt
|
||||
|
|
Loading…
Reference in a new issue