Merge pull request #3751 from rkitover/native-term

mingw: set $env:TERM=xterm-256color for newer OSes
This commit is contained in:
Johannes Schindelin 2022-04-21 09:31:41 +02:00
Родитель 8254a2256c f6cc600a70
Коммит 1184dffef5
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -2902,9 +2902,20 @@ static void setup_windows_environment(void)
convert_slashes(tmp); convert_slashes(tmp);
} }
/* simulate TERM to enable auto-color (see color.c) */
if (!getenv("TERM")) /*
setenv("TERM", "cygwin", 1); * Make sure TERM is set up correctly to enable auto-color
* (see color.c .) Use "cygwin" for older OS releases which
* works correctly with MSYS2 utilities on older consoles.
*/
if (!getenv("TERM")) {
if ((GetVersion() >> 16) < 15063)
setenv("TERM", "cygwin", 0);
else {
setenv("TERM", "xterm-256color", 0);
setenv("COLORTERM", "truecolor", 0);
}
}
/* calculate HOME if not set */ /* calculate HOME if not set */
if (!getenv("HOME")) { if (!getenv("HOME")) {