From c5a55e09577b6d88b5bb51b17012e12ec935e12a Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 20 Feb 2020 23:45:48 +0800 Subject: improve colors.ignore --- xmake/core/base/colors.lua | 12 +++++------- 1 file 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 -- cgit v1.3.1