fix(win): simpler way to add buffer padding

This commit is contained in:
Folke Lemaitre 2024-11-07 18:30:01 +01:00
parent 334895c5bb
commit f59237f1dc
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -387,20 +387,9 @@ function M:show()
end
function M:add_padding()
if not self:buf_valid() then
return
end
local ns = vim.api.nvim_create_namespace("snacks_win_padding")
vim.api.nvim_buf_clear_namespace(self.buf, ns, 0, -1)
self.opts.wo.statuscolumn = " "
self.opts.wo.list = true
self.opts.wo.showbreak = " "
self.opts.wo.listchars = ("eol: ," .. (self.opts.wo.listchars or "")):gsub(",$", "")
for l = 1, vim.api.nvim_buf_line_count(self.buf) do
vim.api.nvim_buf_set_extmark(self.buf, ns, l - 1, 0, {
virt_text = { { " " } },
virt_text_pos = "inline",
})
end
end
function M:is_floating()