Skip to content

Commit 33bc387

Browse files
dschomjcheetham
authored andcommitted
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents f5a4afb + 1979e35 commit 33bc387

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

compat/mingw.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,9 +2919,20 @@ static void setup_windows_environment(void)
29192919
convert_slashes(tmp);
29202920
}
29212921

2922-
/* simulate TERM to enable auto-color (see color.c) */
2923-
if (!getenv("TERM"))
2924-
setenv("TERM", "cygwin", 1);
2922+
2923+
/*
2924+
* Make sure TERM is set up correctly to enable auto-color
2925+
* (see color.c .) Use "cygwin" for older OS releases which
2926+
* works correctly with MSYS2 utilities on older consoles.
2927+
*/
2928+
if (!getenv("TERM")) {
2929+
if ((GetVersion() >> 16) < 15063)
2930+
setenv("TERM", "cygwin", 0);
2931+
else {
2932+
setenv("TERM", "xterm-256color", 0);
2933+
setenv("COLORTERM", "truecolor", 0);
2934+
}
2935+
}
29252936

29262937
/* calculate HOME if not set */
29272938
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)