Skip to content

Commit 2692096

Browse files
committed
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents 966bb1c + eb32704 commit 2692096

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
@@ -2902,9 +2902,20 @@ static void setup_windows_environment(void)
29022902
convert_slashes(tmp);
29032903
}
29042904

2905-
/* simulate TERM to enable auto-color (see color.c) */
2906-
if (!getenv("TERM"))
2907-
setenv("TERM", "cygwin", 1);
2905+
2906+
/*
2907+
* Make sure TERM is set up correctly to enable auto-color
2908+
* (see color.c .) Use "cygwin" for older OS releases which
2909+
* works correctly with MSYS2 utilities on older consoles.
2910+
*/
2911+
if (!getenv("TERM")) {
2912+
if ((GetVersion() >> 16) < 15063)
2913+
setenv("TERM", "cygwin", 0);
2914+
else {
2915+
setenv("TERM", "xterm-256color", 0);
2916+
setenv("COLORTERM", "truecolor", 0);
2917+
}
2918+
}
29082919

29092920
/* calculate HOME if not set */
29102921
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)