diff options
Diffstat (limited to 'xmake/modules/utils/progress.lua')
| -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() |
