Skip to content

Commit 6e4eeaa

Browse files
committed
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents cf888e4 + 4badee2 commit 6e4eeaa

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
@@ -2960,9 +2960,20 @@ static void setup_windows_environment(void)
29602960
convert_slashes(tmp);
29612961
}
29622962

2963-
/* simulate TERM to enable auto-color (see color.c) */
2964-
if (!getenv("TERM"))
2965-
setenv("TERM", "cygwin", 1);
2963+
2964+
/*
2965+
* Make sure TERM is set up correctly to enable auto-color
2966+
* (see color.c .) Use "cygwin" for older OS releases which
2967+
* works correctly with MSYS2 utilities on older consoles.
2968+
*/
2969+
if (!getenv("TERM")) {
2970+
if ((GetVersion() >> 16) < 15063)
2971+
setenv("TERM", "cygwin", 0);
2972+
else {
2973+
setenv("TERM", "xterm-256color", 0);
2974+
setenv("COLORTERM", "truecolor", 0);
2975+
}
2976+
}
29662977

29672978
/* calculate HOME if not set */
29682979
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)