feat(image.inline): honor concealcursor and hide conceal when selecting lines. Closes #1478
Some checks failed
CI / ci (push) Failing after 0s

This commit is contained in:
Folke Lemaitre 2025-03-01 23:37:00 +01:00
parent 1ce91337f1
commit bc0630e43b
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -35,15 +35,18 @@ function M.new(buf)
end
function M:conceal()
local mode = vim.fn.mode()
local cursor = vim.api.nvim_win_get_cursor(0)
local by_mode = not mode:find("[nc]")
local hide = by_mode and self:visible() or self:get(cursor[1], cursor[1])
local mode = vim.fn.mode():sub(1, 1):lower() ---@type string
for _, img in pairs(self.imgs) do
img:show()
end
if vim.wo.concealcursor:find(mode) then
return
end
local from, to = vim.fn.line("v"), vim.fn.line(".")
from, to = math.min(from, to), math.max(from, to)
local hide = self:get(from, to)
for _, img in pairs(hide) do
if by_mode or img.opts.conceal then
if img.opts.conceal then
img:hide()
end
end