diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2022-03-09 07:15:54 +0300 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2022-03-09 07:27:40 +0300 |
commit | e618eb8727b0f9aebb54d48f6978c0bd3a4cf010 (patch) | |
tree | d2d50e0d40575b796036464248d346799407a285 /lldb | |
parent | 43374bee0e0641be417f22fc73c46a914de5ea71 (diff) |
[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.
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 39e83de8b034..3ebf3ceefc3a 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) { |