diff options
| author | ruki <[email protected]> | 2025-11-20 00:46:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-20 00:46:17 +0800 |
| commit | bb23918bcc9423cecc98275759d529adf41f4ca5 (patch) | |
| tree | 2665c846d3f89604fdfb24aa88ff94af0e74f803 /xmake/modules/utils | |
| parent | d4f99444640e55c2170c7407ca567af2047dc558 (diff) | |
add
Diffstat (limited to 'xmake/modules/utils')
| -rw-r--r-- | xmake/modules/utils/progress.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua index 4778c073c..c8846e033 100644 --- a/xmake/modules/utils/progress.lua +++ b/xmake/modules/utils/progress.lua @@ -212,6 +212,12 @@ function _redraw_multirow_progress(maxwidth) return end + -- move cursor back to the top of progress area to avoid scrolling + local linecount = _g.linecount or 0 + if linecount > 0 then + tty.cursor_move_up(linecount + 1) + end + -- redraw the total progress line tty.erase_line().cr() cprint(last_total_progress) @@ -382,6 +388,21 @@ function show_output(format, ...) end end +-- refresh the multirow progress display to update elapsed time +-- this is useful for long-running tasks to keep the elapsed time updated +function refresh() + local refresh_mode = _g.refresh_mode + if refresh_mode == "multirow" then + local maxwidth = os.getwinsize().width + _redraw_multirow_progress(maxwidth) + end +end + +-- check if multirow refresh mode is enabled +function is_multirow() + return _is_multirow_refresh() +end + -- abort the progress display mode, used for error exit or early termination -- this function cleans up the progress display area and restores the terminal state function show_abort() |
