summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-26 21:01:20 +0800
committerruki <[email protected]>2021-01-26 21:01:20 +0800
commitf6382212c2453aa122aa2c0d7eace55f382f7836 (patch)
tree6167761f95cca01e2b837047180513192367e7ab
parentf4abf4fc15d8af62b99e7db96bb9580bb085ffc6 (diff)
add tty.has_emoji
-rw-r--r--xmake/core/base/tty.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/base/tty.lua b/xmake/core/base/tty.lua
index e1b796f13..276a7ea29 100644
--- a/xmake/core/base/tty.lua
+++ b/xmake/core/base/tty.lua
@@ -184,7 +184,23 @@ end
function tty.has_emoji()
local has_emoji = tty._HAS_EMOJI
if has_emoji == nil then
- -- TODO
+ local term = tty.term()
+ local winos = require("base/winos")
+
+ -- before win7 on cmd? disable it
+ if has_emoji == nil and term == "cmd" and winos.version():le("win7") then
+ has_emoji = false
+ end
+
+ -- on msys2/cygwin? disable it
+ if has_emoji == nil and (term == "msys2" or term == "cygwin") then
+ has_emoji = false
+ end
+
+ -- enable it by default
+ if has_emoji == nil then
+ has_emoji = true
+ end
tty._HAS_EMOJI = has_emoji or false
end
return has_emoji