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 aee95b0 + b150496 commit cbb502b
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 @@ -3091,9 +3091,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 cbb502b

Please sign in to comment.