Skip to content

Commit 87ae1f5

Browse files
committed
fix to center align of a progress indicator
th -e 'for i =1,100 do xlua.progress(i,100) end' [============= 100/100 ===========>] Tot: 0ms | Step: 0ms
1 parent ab8ffad commit 87ae1f5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

init.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,14 @@ do
284284
end
285285
-- Print remaining time when running or total time when done.
286286
if (percent < barLength) then
287-
io.write('ETA: ' .. formatTime(remaining))
287+
tm = ' ETA: ' .. formatTime(remaining)
288288
else
289-
io.write('Tot: ' .. formatTime(elapsed))
289+
tm = ' Tot: ' .. formatTime(elapsed)
290290
end
291-
io.write(' | Step: ' .. formatTime(step))
291+
tm = tm .. ' | Step: ' .. formatTime(step)
292+
io.write(tm)
292293
-- go back to center of bar, and print progress
293-
for i=1,6+#tm+barLength/2 do io.write('\b') end
294+
for i=1,5+#tm+barLength/2 do io.write('\b') end
294295
io.write(' ', current, '/', goal, ' ')
295296
-- reset for next bar
296297
if (percent == barLength) then

0 commit comments

Comments
 (0)