Skip to content

Commit f065c2b

Browse files
committed
feat(table): add cell wrapping using virt lines
1 parent 1c95813 commit f065c2b

5 files changed

Lines changed: 383 additions & 2 deletions

File tree

lua/render-markdown/core/manager.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@ function M.init()
3838
end
3939
end,
4040
})
41+
-- terminal / GUI resize — re-render all visible attached windows
42+
vim.api.nvim_create_autocmd('VimResized', {
43+
group = M.group,
44+
callback = function(args)
45+
for _, win in ipairs(vim.api.nvim_list_wins()) do
46+
local buf = env.win.buf(win)
47+
if M.attached(buf) and state.get(buf).enabled then
48+
ui.update(buf, win, args.event, true)
49+
end
50+
end
51+
end,
52+
})
53+
-- wrap option toggled (:set wrap / :set nowrap) — re-render the current window
54+
vim.api.nvim_create_autocmd('OptionSet', {
55+
group = M.group,
56+
pattern = 'wrap',
57+
callback = function(args)
58+
local win = vim.api.nvim_get_current_win()
59+
local buf = env.win.buf(win)
60+
if M.attached(buf) and state.get(buf).enabled then
61+
ui.update(buf, win, args.event, true)
62+
end
63+
end,
64+
})
4165
end
4266

4367
---@param buf integer

lua/render-markdown/lib/marks.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ function Marks:run_update(mark)
132132
self.context.offset:add(row, {
133133
col = start_col,
134134
width = str.line_width(opts.virt_text),
135+
virt_text = opts.virt_text or {},
135136
})
136137
end
137138
end

0 commit comments

Comments
 (0)