Skip to content

Commit d215b56

Browse files
committed
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents 256cf2e + 144cf12 commit d215b56

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
@@ -2955,9 +2955,20 @@ static void setup_windows_environment(void)
29552955
convert_slashes(tmp);
29562956
}
29572957

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

29622973
/* calculate HOME if not set */
29632974
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)