mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(image): return converted filename instead of original src. Closes #1213
This commit is contained in:
parent
1cbe84ea53
commit
118eab0cfd
2 changed files with 4 additions and 3 deletions
|
@ -59,7 +59,7 @@ function M:on_send()
|
|||
end
|
||||
|
||||
function M:ready()
|
||||
return (not self._convert or self._convert:is_closing()) and (self.file and vim.fn.filereadable(self.file) == 1)
|
||||
return (not self._convert or self._convert:is_closing()) and self.file and vim.fn.filereadable(self.file) == 1
|
||||
end
|
||||
|
||||
function M:convert()
|
||||
|
@ -75,7 +75,7 @@ function M:convert()
|
|||
src = vim.fs.normalize(src)
|
||||
end
|
||||
local fin = src .. "[0]"
|
||||
local root = vim.fn.stdpath("cache") .. "/snacks/image"
|
||||
local root = Snacks.image.config.cache
|
||||
vim.fn.mkdir(root, "p")
|
||||
src = root .. "/" .. Snacks.util.file_encode(fin) .. ".png"
|
||||
if vim.fn.filereadable(src) == 1 then
|
||||
|
@ -91,7 +91,7 @@ function M:convert()
|
|||
end)
|
||||
end
|
||||
end)
|
||||
return self.src
|
||||
return src
|
||||
end
|
||||
|
||||
-- create the image
|
||||
|
|
|
@ -75,6 +75,7 @@ local defaults = {
|
|||
spell = false,
|
||||
statuscolumn = "",
|
||||
},
|
||||
cache = vim.fn.stdpath("cache") .. "/snacks/image",
|
||||
debug = false,
|
||||
env = {},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue