diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 69f64af479..66efbd3b75 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1874,7 +1874,7 @@ int cmcmd::ExecuteEchoColor(std::vector const& args) bool enabled = true; static cm::StdIo::TermAttrSet const noAttrs; - cm::StdIo::TermAttrSet attrs = cm::StdIo::TermAttr::Normal; + cm::StdIo::TermAttrSet attrs; bool newline = true; std::string progressDir; for (auto const& arg : cmMakeRange(args).advance(2)) { @@ -1910,6 +1910,9 @@ int cmcmd::ExecuteEchoColor(std::vector const& args) } else if (arg == "--white") { attrs = cm::StdIo::TermAttr::ForegroundWhite; } else if (arg == "--bold") { + if (attrs.empty()) { + attrs = cm::StdIo::TermAttr::Normal; + } attrs |= cm::StdIo::TermAttr::ForegroundBold; } else if (arg == "--no-newline") { newline = false;