summaryrefslogtreecommitdiff
path: root/xmake/modules/utils/progress.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-30 23:44:18 +0800
committerruki <[email protected]>2025-10-30 23:44:18 +0800
commit1a6b82357bb1ba437984fc46c77aa812873a169c (patch)
treefe8a6eabbec8412f135b00fe3b7c3e1ec12d21ad /xmake/modules/utils/progress.lua
parent8f4090acd166b5b1db0e0fd22270d40c70504d7c (diff)
fix output end
Diffstat (limited to 'xmake/modules/utils/progress.lua')
-rw-r--r--xmake/modules/utils/progress.lua24
1 files changed, 13 insertions, 11 deletions
diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua
index 87788350e..a29d7cd2b 100644
--- a/xmake/modules/utils/progress.lua
+++ b/xmake/modules/utils/progress.lua
@@ -195,13 +195,11 @@ function _display_subprocess_lines(order_lineinfos)
if progress_running and progress_running:data("runjobs.running") == false then
lineinfo.progress_line = nil
end
- tty.erase_line().cr()
if lineinfo.progress_line then
+ tty.erase_line().cr()
cprint(lineinfo.progress_line)
- else
- print("")
+ linecount = linecount + 1
end
- linecount = linecount + 1
end
_g.linecount = linecount
end
@@ -281,19 +279,23 @@ function _show_progress_with_multirow_refresh(progress, format, ...)
end
-- build and display the subprocess lines
- local order_lineinfos = _build_ordered_subprocess_lineinfos(maxwidth, current_time)
- current_lineinfo.start_time = current_time
- _display_subprocess_lines(order_lineinfos)
-
- if is_finished then
+ if not is_finished then
+ local order_lineinfos = _build_ordered_subprocess_lineinfos(maxwidth, current_time)
+ current_lineinfo.start_time = current_time
+ _display_subprocess_lines(order_lineinfos)
+ _g.refresh_mode = "multirow"
+ else
+ -- when finished, clear all subprocess lines without leaving empty lines
+ local old_linecount = _g.linecount or 0
+ if old_linecount > 0 then
+ tty.erase_down()
+ end
_g.refresh_mode = nil
_g.progress_lineinfos = nil
_g.last_total_progress = nil
_g.last_total_progress_value = nil
_g.linecount = 0
tty.cursor_show()
- else
- _g.refresh_mode = "multirow"
end
io.flush()
end