mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(image): show progress indicator when converting image files
This commit is contained in:
parent
8d073ccc0c
commit
b65178b470
9 changed files with 108 additions and 33 deletions
|
@ -6,7 +6,6 @@
|
|||
local M = {}
|
||||
M.__index = M
|
||||
|
||||
local uv = vim.uv or vim.loop
|
||||
local ns = vim.api.nvim_create_namespace("snacks.picker.input")
|
||||
|
||||
---@param picker snacks.Picker
|
||||
|
@ -144,7 +143,7 @@ function M:update()
|
|||
end
|
||||
local line = {} ---@type snacks.picker.Highlight[]
|
||||
if self.picker:is_active() then
|
||||
line[#line + 1] = { M.spinner(), "SnacksPickerSpinner" }
|
||||
line[#line + 1] = { Snacks.util.spinner(), "SnacksPickerSpinner" }
|
||||
line[#line + 1] = { " " }
|
||||
end
|
||||
local selected = #self.picker.list.selected
|
||||
|
@ -188,9 +187,4 @@ function M:set(pattern, search)
|
|||
self.picker:update_titles()
|
||||
end
|
||||
|
||||
function M.spinner()
|
||||
local spinner = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
return spinner[math.floor(uv.hrtime() / (1e6 * 80)) % #spinner + 1]
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -182,7 +182,9 @@ function M.cmd(cmd, ctx, opts)
|
|||
if ctx.picker.opts.debug.proc then
|
||||
local args = vim.deepcopy(cmd)
|
||||
table.remove(args, 1)
|
||||
Snacks.debug.cmd({ cmd = cmd[1], args = args, cwd = ctx.item.cwd })
|
||||
vim.schedule(function()
|
||||
Snacks.debug.cmd({ cmd = cmd[1], args = args, cwd = ctx.item.cwd })
|
||||
end)
|
||||
end
|
||||
|
||||
---@param text string
|
||||
|
|
|
@ -40,7 +40,9 @@ function M.proc(opts, ctx)
|
|||
end
|
||||
|
||||
if ctx.picker.opts.debug.proc then
|
||||
Snacks.debug.cmd(Snacks.config.merge(opts, { group = true }))
|
||||
vim.schedule(function()
|
||||
Snacks.debug.cmd(Snacks.config.merge(opts, { group = true }))
|
||||
end)
|
||||
end
|
||||
|
||||
local sep = opts.sep or "\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue