From ae8cfb4aa919000b283a0fe7db96b1a321a010d3 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 3 Nov 2026 12:22:03 +0100 Subject: Add multi-row progress display with a global progress bar Replace the single-line progress bar with a terminal renderer that shows one row per active progress tag. The overall restore step (Uploading/Verifying filesystem, Flashing firmware) is a reserved "global" bar that is always drawn first. Per-component bars (e.g. SEP, RestoreRamDisk) appear below it and disappear when finalized. - Redraw in place with ANSI cursor movement; clamp line width to the terminal width (ioctl on Unix, console API on Windows, with virtual terminal mode enabled) - Erase and redraw the bars around logger() output so log lines no longer corrupt the display - Remove the global bar once a different restore step starts - When stdout is not a TTY, skip escape codes and print only the changed bar, once per 1% step - Fix progress throttling: lastprog was an int and was compared after being overwritten, so granularity was never applied - RESTORE_STEP_UPLOAD_IMG no longer drives the global bar; it already has per-component bars --- src/common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/common.h') diff --git a/src/common.h b/src/common.h index 3bb648a..c634e24 100644 --- a/src/common.h +++ b/src/common.h @@ -144,7 +144,7 @@ struct progress_info_entry { uint32_t tag; char* label; double progress; - int lastprog; + double lastprog; }; void set_update_progress_func(void (*func)(struct progress_info_entry** list, int count)); void set_progress_granularity(double granularity); @@ -154,6 +154,8 @@ void register_progress(uint32_t tag, const char* label); void set_progress(uint32_t tag, double progress); void finalize_progress(uint32_t tag); void print_progress_bar(const char* prefix, double progress); +void progress_display_suspend(void); +void progress_display_resume(void); struct tuple { int idx; -- cgit v1.1-32-gdbae