mirror of
https://github.com/neovim/neovim.git
synced 2026-02-19 09:58:32 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user