Skip to content

Commit 34a0d72

Browse files
dschomjcheetham
authored andcommitted
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents 4f2a326 + a75e8ed commit 34a0d72

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
@@ -2939,9 +2939,20 @@ static void setup_windows_environment(void)
29392939
convert_slashes(tmp);
29402940
}
29412941

2942-
/* simulate TERM to enable auto-color (see color.c) */
2943-
if (!getenv("TERM"))
2944-
setenv("TERM", "cygwin", 1);
2942+
2943+
/*
2944+
* Make sure TERM is set up correctly to enable auto-color
2945+
* (see color.c .) Use "cygwin" for older OS releases which
2946+
* works correctly with MSYS2 utilities on older consoles.
2947+
*/
2948+
if (!getenv("TERM")) {
2949+
if ((GetVersion() >> 16) < 15063)
2950+
setenv("TERM", "cygwin", 0);
2951+
else {
2952+
setenv("TERM", "xterm-256color", 0);
2953+
setenv("COLORTERM", "truecolor", 0);
2954+
}
2955+
}
29452956

29462957
/* calculate HOME if not set */
29472958
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)