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 Oct 22, 2024
2 parents d91c6db + fcc59e7 commit 9ffe61f
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 @@ -2946,9 +2946,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 9ffe61f

Please sign in to comment.