From 78fbca3703985224cb6e084217883881a874304f Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Fri, 26 Feb 2010 08:55:13 +0200 Subject: More robust progress bar building --- luaotfload-fonts.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'luaotfload-fonts.lua') diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua index d9b01f2..4b7ce97 100644 --- a/luaotfload-fonts.lua +++ b/luaotfload-fonts.lua @@ -63,10 +63,10 @@ local function progress(current, total) -- local width = os.getenv("COLUMNS") -2 --doesn't work local width = 78 local percent = current/total - local gauge = format("[%s]", rep(" ", width)) + local gauge = format("[%s]", string.rpadd(" ", width, " ")) if percent > 0 then - done = (width * percent) >= 1 and (width * percent) or 1 - gauge = format("[%s>%s]", rep("=", done - 1), rep(" ", width - done)) + local done = string.rpadd("=", (width * percent) - 1, "=") .. ">" + gauge = format("[%s]", string.rpadd(done, width, " ") ) end if percent == 1 then gauge = gauge .. "\n" -- cgit v1.2.3