[Lldb-commits] [lldb] e618eb8 - [lldb] A few small changes to HandleProgressEvent
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 8 20:28:26 PST 2022
Author: Jonas Devlieghere
Date: 2022-03-08T20:27:40-08:00
New Revision: e618eb8727b0f9aebb54d48f6978c0bd3a4cf010
URL: https://github.com/llvm/llvm-project/commit/e618eb8727b0f9aebb54d48f6978c0bd3a4cf010
DIFF: https://github.com/llvm/llvm-project/commit/e618eb8727b0f9aebb54d48f6978c0bd3a4cf010.diff
LOG: [lldb] A few small changes to HandleProgressEvent
Of course I only noticed these things *after* landing the original
patch...
- Flush the output after clearing the line.
- Move up the printing the carriage return to avoid duplication.
- Use hexadecimal instead of octal for escape codes.
Added:
Modified:
lldb/source/Core/Debugger.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 39e83de8b0347..3ebf3ceefc3a8 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1783,9 +1783,13 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
if (!output.GetIsInteractive() || !output.GetIsTerminalWithColors())
return;
+ // Print over previous line, if any.
+ output.Printf("\r");
+
if (data->GetCompleted()) {
// Clear the current line.
- output.Printf("\33[2K\r");
+ output.Printf("\x1B[2K");
+ output.Flush();
return;
}
@@ -1795,9 +1799,6 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
output.Printf(
"%s", ansi::FormatAnsiTerminalCodes(ansi_prefix, use_color).c_str());
- // Print over previous line, if any.
- output.Printf("\r");
-
// Print the progress message.
std::string message = data->GetMessage();
if (data->GetTotal() != UINT64_MAX) {
More information about the lldb-commits
mailing list