Skip to content

Commit

Permalink
Merge pull request #3751 from rkitover/native-term
Browse files Browse the repository at this point in the history
mingw: set $env:TERM=xterm-256color for newer OSes
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Nov 25, 2024
2 parents b2e7f19 + 24c1983 commit 28c1687
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2942,9 +2942,20 @@ static void setup_windows_environment(void)
convert_slashes(tmp);
}

/* simulate TERM to enable auto-color (see color.c) */
if (!getenv("TERM"))
setenv("TERM", "cygwin", 1);

/*
* Make sure TERM is set up correctly to enable auto-color
* (see color.c .) Use "cygwin" for older OS releases which
* works correctly with MSYS2 utilities on older consoles.
*/
if (!getenv("TERM")) {
if ((GetVersion() >> 16) < 15063)
setenv("TERM", "cygwin", 0);
else {
setenv("TERM", "xterm-256color", 0);
setenv("COLORTERM", "truecolor", 0);
}
}

/* calculate HOME if not set */
if (!getenv("HOME")) {
Expand Down

0 comments on commit 28c1687

Please sign in to comment.