fix(image.placement): max width/height in cells is 297. Closes #1345
Some checks failed
CI / ci (push) Failing after 0s

This commit is contained in:
Folke Lemaitre 2025-02-20 18:12:47 +01:00
parent 8707da2a70
commit 5fa93cb684
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -187,9 +187,11 @@ function M:render_grid(loc)
},
})
local lines = {} ---@type string[]
for r = 1, loc.height do
local height = math.min(#diacritics, loc.height)
local width = math.min(#diacritics, loc.width)
for r = 1, height do
local line = {} ---@type string[]
for c = 1, loc.width do
for c = 1, width do
-- cell positions are encoded as diacritics for the placeholder unicode character
line[#line + 1] = PLACEHOLDER
line[#line + 1] = positions[r]
@ -225,7 +227,7 @@ function M:render_grid(loc)
vim.api.nvim_buf_set_lines(self.buf, 0, -1, false, lines)
vim.bo[self.buf].modifiable = false
vim.bo[self.buf].modified = false
for r = 1, loc.height do
for r = 1, #lines do
vim.api.nvim_buf_set_extmark(self.buf, self.ns, r - 1, 0, {
end_col = #lines[r],
hl_group = hl,