fix(pack): skip :redraw! if headless #37782

Otherwise, output will be concatenated without newlines.

TODO: the ":redraw!" call can be dropped entirely after ui2 becomes the default.
This commit is contained in:
Andrew Braxton
2026-02-12 04:15:53 -05:00
committed by GitHub
parent 6b4ec2264e
commit 5468e6a452

View File

@@ -484,6 +484,7 @@ end
--- @return fun(kind: 'begin'|'report'|'end', percent: integer, fmt: string, ...:any): nil
local function new_progress_report(action)
local progress = { kind = 'progress', title = 'vim.pack' }
local headless = #api.nvim_list_uis() == 0
return vim.schedule_wrap(function(kind, percent, fmt, ...)
progress.status = kind == 'end' and 'success' or 'running'
@@ -491,7 +492,10 @@ local function new_progress_report(action)
local msg = ('%s %s'):format(action, fmt:format(...))
progress.id = api.nvim_echo({ { msg } }, kind ~= 'report', progress)
-- Force redraw to show installation progress during startup
vim.cmd.redraw({ bang = true })
-- TODO: redraw! not needed with ui2.
if not headless then
vim.cmd.redraw({ bang = true })
end
end)
end