refactor(progress): simplify progress-status format #38491

Problem:
Currently we are using
if 1 item then
  {title}: {percent}%
else
  Progress: {AVG}%({N})
dropping {title} and Progress text saves up space in statusline plus makes the format consistent, less jumping around.

Solution:
Use `{AVG}%({N})` for all cases.
This commit is contained in:
Shadman
2026-03-26 15:47:16 +06:00
committed by GitHub
parent c9e961994b
commit 3e6d5875ca
2 changed files with 8 additions and 14 deletions

View File

@@ -359,19 +359,13 @@ do
local count = #running
if count == 0 then
return '' -- nothing to show
elseif count == 1 then
local progress_item = running[1]
if progress_item.title == nil then
return string.format('%d%%%% ', progress_item.percent or 0)
end
return string.format('%s: %d%%%% ', progress_item.title, progress_item.percent or 0)
else
local sum = 0 ---@type integer
for _, progress_item in ipairs(running) do
sum = sum + (progress_item.percent or 0)
end
local avg = math.floor(sum / count)
return string.format('Progress: %d%%%%(%d) ', avg, count)
return string.format('%d%%%%(%d) ', avg, count)
end
end