summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-20 23:45:48 +0800
committerruki <[email protected]>2020-02-20 16:34:51 +0800
commitc5a55e09577b6d88b5bb51b17012e12ec935e12a (patch)
tree1253c023731a17b830832637fc8b166188f9f74a
parent3a5c3f41d66dceb79fa4a61faaefce2421da8160 (diff)
improve colors.ignore
-rw-r--r--xmake/core/base/colors.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua
index d3d386011..4071f636f 100644
--- a/xmake/core/base/colors.lua
+++ b/xmake/core/base/colors.lua
@@ -432,14 +432,12 @@ end
-- ignore all colors
function colors.ignore(str)
-
- -- check string
- if not str then
- return nil
+ if str then
+ -- strip "${red}" and "${theme color}"
+ str = colors.translate(str, {plain = true})
+ -- strip color code, e.g. for clang/gcc color diagnostics output
+ return (str:gsub("\x1b%[.-m", ""))
end
-
- -- ignore it
- return colors.translate(str, {plain = true})
end
-- get theme