================
@@ -419,13 +419,23 @@ inline void OutputWordWrappedLines(Stream &strm,
llvm::StringRef text,
const uint32_t max_text_width =
output_max_columns - strm.GetIndentLevel() - 1;
bool first_line = true;
+ const std::string ansi_indent =
+ ANSI_CSI_CUF(std::to_string(strm.GetIndentLevel()));
while (!text.empty()) {
std::string split = TrimAtWordBoundary(text, max_text_width);
if (!first_line)
strm.EOL();
first_line = false;
- strm.Indent(split);
+
+ if (use_color) {
+ // If we are allowed to use colour (aka ANSI codes), we can indent using
+ // ANSI cursor movement. This means that if an ANSI formatted range of
+ // text is split across two lines, the indentation is not also formatted.
+ // Which it would be if we just emitted spaces.
+ strm << ansi_indent << split;
+ } else
+ strm.Indent(split);
----------------
JDevlieghere wrote:
```suggestion
} else {
strm.Indent(split);
}
```
https://github.com/llvm/llvm-project/pull/183558
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits