mirror of
https://github.com/neovim/neovim.git
synced 2025-11-13 13:59:16 +00:00
feat(pack): use colored nvim_echo chunks to show progress report
Problem: using `print()` to show progress report writes to `stdout` when in `--headless` mode (interferes with the testing output) and doesn't allow coloring. Solution: use `nvim_echo` with colored chunks.
This commit is contained in:
@@ -372,7 +372,9 @@ local function new_progress_report(title)
|
|||||||
|
|
||||||
return vim.schedule_wrap(function(kind, percent, fmt, ...)
|
return vim.schedule_wrap(function(kind, percent, fmt, ...)
|
||||||
local progress = kind == 'end' and 'done' or ('%3d%%'):format(percent)
|
local progress = kind == 'end' and 'done' or ('%3d%%'):format(percent)
|
||||||
print(('(vim.pack) %s: %s %s'):format(progress, title, fmt:format(...)))
|
local details = (': %s %s'):format(title, fmt:format(...))
|
||||||
|
local chunks = { { '(vim.pack)', 'ModeMsg' }, { ' ' }, { progress, 'WarningMsg' }, { details } }
|
||||||
|
vim.api.nvim_echo(chunks, true, { kind = 'progress' })
|
||||||
-- Force redraw to show installation progress during startup
|
-- Force redraw to show installation progress during startup
|
||||||
vim.cmd.redraw({ bang = true })
|
vim.cmd.redraw({ bang = true })
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user