Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
dscho committed Jan 7, 2025

Verified

This commit was signed with the committer’s verified signature.
rm3l Armel Soro
2 parents 985f614 + b72b0f7 commit a4f5d84
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
@@ -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")) {

0 comments on commit a4f5d84

Please sign in to comment.