fix(image): detach image when reloading image file. Closes #2343

This commit is contained in:
Folke Lemaitre 2025-10-25 06:43:26 +02:00
parent c9528341a6
commit 7bf4175588
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -4,10 +4,7 @@ local M = {}
---@param buf number
---@param opts? snacks.image.Opts|{src?: string}
function M._attach(buf, opts)
if vim.b[buf].snacks_image_buf_attached then
return
end
vim.b[buf].snacks_image_buf_attached = true
Snacks.image.placement.clean(buf)
opts = opts or {}
local file = opts.src or vim.api.nvim_buf_get_name(buf)
if not Snacks.image.supports(file) then