Skip to content

Commit e6cd152

Browse files
committed
fix(table): wrapped eof bottom border
1 parent 372c060 commit e6cd152

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,12 @@ function Render:border()
760760
virt_text_pos = 'overlay',
761761
})
762762
else
763-
self.marks:add(self.config, 'virtual_lines', node.start_row, 0, {
763+
local col = 0
764+
if not above and self.layout.wrap then
765+
-- Place after wrapped row virtual lines at column 0.
766+
col = node.end_col
767+
end
768+
self.marks:add(self.config, 'virtual_lines', node.start_row, col, {
764769
virt_lines = { self:indent():line(true):extend(line):get() },
765770
virt_lines_above = above,
766771
})

tests/table_spec.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,26 @@ describe('table', function()
279279
'└───────────┴───────────┘',
280280
})
281281
end)
282+
283+
it('wrapped eof bottom border', function()
284+
util.setup.text({
285+
'',
286+
'| ID | Title | Status |',
287+
'| -- | ----- | ------ |',
288+
'| 1 | This sentence is long enough to wrap across several rendered table lines without needing a trailing blank line. | Open |',
289+
}, {
290+
pipe_table = { max_table_width = 60 },
291+
win_options = { wrap = { default = false, rendered = true } },
292+
})
293+
294+
util.assert_screen({
295+
'┌──────┬────────────────────────────────────────┬──────────┐',
296+
'│ ID │ Title │ Status │',
297+
'├──────┼────────────────────────────────────────┼──────────┤',
298+
'│ 1 │ This sentence is long enough to wrap a │ Open │',
299+
'│ │ cross several rendered table lines wit │ │',
300+
'│ │ hout needing a trailing blank line. │ │',
301+
'└──────┴────────────────────────────────────────┴──────────┘',
302+
})
303+
end)
282304
end)

0 commit comments

Comments
 (0)