diff options
| author | Dan Engelbrecht <[email protected]> | 2026-04-17 15:00:01 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-17 15:00:01 +0200 |
| commit | f07e04aa501b26b96e345f2e8ac42d231a015e55 (patch) | |
| tree | 08e07834196931c567be918e5852ef649a9d57cd /src/zen/progressbar.cpp | |
| parent | log cleanup (#969) (diff) | |
| download | archived-zen-f07e04aa501b26b96e345f2e8ac42d231a015e55.tar.xz archived-zen-f07e04aa501b26b96e345f2e8ac42d231a015e55.zip | |
replace pretty progress with prettyscroll implementation (#970)
Diffstat (limited to 'src/zen/progressbar.cpp')
| -rw-r--r-- | src/zen/progressbar.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/zen/progressbar.cpp b/src/zen/progressbar.cpp index 34174d35d..780b08707 100644 --- a/src/zen/progressbar.cpp +++ b/src/zen/progressbar.cpp @@ -151,7 +151,6 @@ GetUpdateDelayMS(ProgressBar::Mode InMode) case ProgressBar::Mode::Plain: return 5000; case ProgressBar::Mode::Pretty: - case ProgressBar::Mode::PrettyScroll: return 200; case ProgressBar::Mode::Log: return 2000; @@ -205,7 +204,7 @@ ProgressBar::PopLogOperation(Mode InMode) } ProgressBar::ProgressBar(Mode InMode, std::string_view InSubTask) -: m_Mode((!TuiIsStdoutTty() && (InMode == Mode::Pretty || InMode == Mode::PrettyScroll)) ? Mode::Plain : InMode) +: m_Mode((!TuiIsStdoutTty() && InMode == Mode::Pretty) ? Mode::Plain : InMode) , m_LastUpdateMS((uint64_t)-1) , m_PausedMS(0) , m_SubTask(InSubTask) @@ -216,7 +215,7 @@ ProgressBar::ProgressBar(Mode InMode, std::string_view InSubTask) PushLogOperation(InMode, m_SubTask); } - if (m_Mode == Mode::PrettyScroll) + if (m_Mode == Mode::Pretty) { SetupScrollRegion(); } @@ -242,6 +241,12 @@ ProgressBar::~ProgressBar() void ProgressBar::SetupScrollRegion() { + // Only one scroll region owner at a time; nested bars fall back to the inline \r path. + if (g_ActiveScrollRegionOwner.load(std::memory_order_acquire) != nullptr) + { + return; + } + uint32_t Rows = TuiConsoleRows(0); if (Rows < 3) { @@ -375,7 +380,7 @@ ProgressBar::UpdateState(const State& NewState, bool DoLinebreak) OutputToConsoleRaw(Output); m_State = NewState; } - else if (m_Mode == Mode::Pretty || m_Mode == Mode::PrettyScroll) + else if (m_Mode == Mode::Pretty) { size_t ProgressBarSize = 20; @@ -432,7 +437,7 @@ ProgressBar::UpdateState(const State& NewState, bool DoLinebreak) } else { - // Fallback: inline \r-based overwrite (original behavior) + // Fallback: inline \r-based overwrite (terminal too small for scroll region) std::string_view Output = OutputBuilder.ToView(); std::string::size_type EraseLength = m_LastOutputLength > (Output.length() + 1) ? (m_LastOutputLength - Output.length() - 1) : 0; |