Skip to content

Commit

Permalink
Print function updated
Browse files Browse the repository at this point in the history
  • Loading branch information
talha-10xE committed Nov 30, 2023
1 parent fa65407 commit 8bd5846
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lldb/source/Utility/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,13 @@ void Stream::PutCStringColorHighlighted(llvm::StringRef text,
llvm::SmallVector<llvm::StringRef, 1> matches;
llvm::StringRef remaining = text;
std::string format_str = lldb_private::ansi::FormatAnsiTerminalCodes(
"${ansi.fg.red}%s${ansi.normal}");
"${ansi.fg.red}%.*s${ansi.normal}");
while (reg_pattern.match(remaining, &matches)) {
llvm::StringRef match = matches[0];
size_t match_start_pos = match.data() - remaining.data();
Write(remaining.data(), match_start_pos);
size_t last_pos = match_start_pos;
Printf(format_str.c_str(), match.str().c_str());
last_pos += match.size();
remaining = remaining.drop_front(last_pos);
PutCString(remaining.take_front(match_start_pos));
Printf(format_str.c_str(), match.size(), match.data());
remaining = remaining.drop_front(match_start_pos + match.size());
}
if (remaining.size())
PutCString(remaining);
Expand Down

0 comments on commit 8bd5846

Please sign in to comment.