mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-10 06:35:09 +00:00
fix(image.placement): max width/height in cells is 297. Closes #1345
Some checks failed
CI / ci (push) Failing after 0s
Some checks failed
CI / ci (push) Failing after 0s
This commit is contained in:
parent
8707da2a70
commit
5fa93cb684
1 changed files with 5 additions and 3 deletions
|
@ -187,9 +187,11 @@ function M:render_grid(loc)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
local lines = {} ---@type string[]
|
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[]
|
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
|
-- cell positions are encoded as diacritics for the placeholder unicode character
|
||||||
line[#line + 1] = PLACEHOLDER
|
line[#line + 1] = PLACEHOLDER
|
||||||
line[#line + 1] = positions[r]
|
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.api.nvim_buf_set_lines(self.buf, 0, -1, false, lines)
|
||||||
vim.bo[self.buf].modifiable = false
|
vim.bo[self.buf].modifiable = false
|
||||||
vim.bo[self.buf].modified = 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, {
|
vim.api.nvim_buf_set_extmark(self.buf, self.ns, r - 1, 0, {
|
||||||
end_col = #lines[r],
|
end_col = #lines[r],
|
||||||
hl_group = hl,
|
hl_group = hl,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue