Skip to content

Commit 2c808ae

Browse files
committed
fix(table): remove unnecessary line height check
1 parent ea47eca commit 2c808ae

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

lua/render-markdown/render/markdown/table.lua

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -606,36 +606,34 @@ function Render:row_wrapped(row, row_index)
606606
})
607607

608608
-- Lines 1..height-1: overlay buffer wrap continuations, then virt_lines.
609-
if height > 1 then
610-
local virt_lines = {} ---@type render.md.mark.Line[]
611-
for vl = 1, height - 1 do
612-
if vl < buf_screen_lines then
613-
local byte_col = vim.fn.byteidx(buf_line, vl * win_width)
614-
if byte_col < 0 then byte_col = #buf_line end
615-
if #virt_lines > 0 then
616-
self.marks:add(self.config, 'virtual_lines', row.node.start_row, 0, {
617-
virt_lines = virt_lines,
618-
virt_lines_above = false,
619-
})
620-
virt_lines = {}
621-
end
622-
self.marks:add(self.config, 'table_border', row.node.start_row, byte_col, {
623-
virt_text = build_line(vl):get(),
624-
virt_text_pos = 'overlay',
625-
hl_mode = 'combine',
609+
local virt_lines = {} ---@type render.md.mark.Line[]
610+
for vl = 1, height - 1 do
611+
if vl < buf_screen_lines then
612+
local byte_col = vim.fn.byteidx(buf_line, vl * win_width)
613+
if byte_col < 0 then byte_col = #buf_line end
614+
if #virt_lines > 0 then
615+
self.marks:add(self.config, 'virtual_lines', row.node.start_row, 0, {
616+
virt_lines = virt_lines,
617+
virt_lines_above = false,
626618
})
627-
else
628-
local vline = self:indent():line(true):extend(build_line(vl))
629-
virt_lines[#virt_lines + 1] = vline:get()
619+
virt_lines = {}
630620
end
631-
end
632-
if #virt_lines > 0 then
633-
self.marks:add(self.config, 'virtual_lines', row.node.start_row, 0, {
634-
virt_lines = virt_lines,
635-
virt_lines_above = false,
621+
self.marks:add(self.config, 'table_border', row.node.start_row, byte_col, {
622+
virt_text = build_line(vl):get(),
623+
virt_text_pos = 'overlay',
624+
hl_mode = 'combine',
636625
})
626+
else
627+
local vline = self:indent():line(true):extend(build_line(vl))
628+
virt_lines[#virt_lines + 1] = vline:get()
637629
end
638630
end
631+
if #virt_lines > 0 then
632+
self.marks:add(self.config, 'virtual_lines', row.node.start_row, 0, {
633+
virt_lines = virt_lines,
634+
virt_lines_above = false,
635+
})
636+
end
639637
end
640638

641639
---Use low priority to include pipe marks

0 commit comments

Comments
 (0)