mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
StdIo: Fix Terminal abstraction to avoid unnecessary VT100 escape sequences
Fix commit 329d755dbd
(StdIo: Add a Terminal abstraction to print color
text, 2025-05-06, v4.1.0-rc1~151^2~3) to avoid printing a VT100 escape
sequence for normal text if we did not print any sequence initially.
We already use this approach for Windows Console text attributes.
Issue: #26924
This commit is contained in:
@@ -141,9 +141,13 @@ void Print(OStream& os, TermAttrSet const& attrs,
|
|||||||
f(os.IOS());
|
f(os.IOS());
|
||||||
break;
|
break;
|
||||||
case TermKind::VT100:
|
case TermKind::VT100:
|
||||||
SetVT100Attrs(os.IOS(), attrs);
|
if (!attrs.empty()) {
|
||||||
f(os.IOS());
|
SetVT100Attrs(os.IOS(), attrs);
|
||||||
SetVT100Attrs(os.IOS(), TermAttr::Normal);
|
f(os.IOS());
|
||||||
|
SetVT100Attrs(os.IOS(), TermAttr::Normal);
|
||||||
|
} else {
|
||||||
|
f(os.IOS());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case TermKind::Console: {
|
case TermKind::Console: {
|
||||||
|
Reference in New Issue
Block a user