summaryrefslogtreecommitdiff
path: root/xmake/core/base/tty.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-28 22:36:55 +0800
committerruki <[email protected]>2021-01-28 22:36:55 +0800
commitc4795dc197dee6d1544539c67de090de9abcb4df (patch)
treeba1833f582381eee98cbbae8501d9e6045cf4924 /xmake/core/base/tty.lua
parent6b1945cee5e5bdf8176af690bae5068a23f6171a (diff)
improve tty for cmder
Diffstat (limited to 'xmake/core/base/tty.lua')
-rw-r--r--xmake/core/base/tty.lua26
1 files changed, 15 insertions, 11 deletions
diff --git a/xmake/core/base/tty.lua b/xmake/core/base/tty.lua
index 1b257866a..393456096 100644
--- a/xmake/core/base/tty.lua
+++ b/xmake/core/base/tty.lua
@@ -156,6 +156,18 @@ function tty.term()
end
end
+ -- get term from $TERM
+ if term == nil then
+ local TERM = os.getenv("TERM")
+ if TERM ~= nil then
+ if TERM:find("xterm", 1, true) then
+ term = "xterm"
+ elseif TERM == "cygwin" then
+ term == "cygwin"
+ end
+ end
+ end
+
-- get term from system
if term == nil then
local subhost = xmake._SUBHOST
@@ -178,16 +190,6 @@ function tty.term()
term = "xterm"
end
end
-
- -- get term from $TERM
- if term == nil then
- local TERM = os.getenv("TERM")
- if TERM ~= nil then
- if TERM:find("xterm", 1, true) then
- term = "xterm"
- end
- end
- end
tty._TERM = term or "unknown"
end
return term
@@ -250,7 +252,9 @@ function tty.has_color8()
if has_color8 == nil then
if os.host() == "windows" then
local winos = require("base/winos")
- if winos.version():le("win7") then
+ if os.getenv("ANSICON") then
+ has_color8 = true
+ elseif winos.version():le("win7") then
has_color8 = false
else
has_color8 = true