Merge topic 'stdio-terminal'

914803bf31 Makefile: Fix regression that prints unnecessary VT100 escape sequences
a0a9e48f85 StdIo: Fix Terminal abstraction to avoid unnecessary VT100 escape sequences

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11080
This commit is contained in:
Brad King
2025-08-14 13:17:45 +00:00
committed by Kitware Robot
2 changed files with 11 additions and 4 deletions

View File

@@ -141,9 +141,13 @@ void Print(OStream& os, TermAttrSet const& attrs,
f(os.IOS());
break;
case TermKind::VT100:
SetVT100Attrs(os.IOS(), attrs);
f(os.IOS());
SetVT100Attrs(os.IOS(), TermAttr::Normal);
if (!attrs.empty()) {
SetVT100Attrs(os.IOS(), attrs);
f(os.IOS());
SetVT100Attrs(os.IOS(), TermAttr::Normal);
} else {
f(os.IOS());
}
break;
#ifdef _WIN32
case TermKind::Console: {

View File

@@ -1923,7 +1923,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string> 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)) {
@@ -1959,6 +1959,9 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string> 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;