How to collapse nui.line(s) with their node? #336
-
Hello there, Me again. So now i kinda got the formatting like i wanna have it and can also collapse my nodes via mapping (thats very great btw thank you for those features), but if i collapse a node only the child nodes are collapsed but not the lines of the node itself which is collapsed. My code for reference (https://github.com/Otterpatsch/bitbucket.nvim/blob/feature/add-discussion-section/lua/bitbucket/init.lua#L51)
To collapse the current node (from the wiki):
I thought okay lets just collapse .text from node but this is not working. So i would like to collapse all the lines but the very first one in lines. So how can i anyway collapse all the lines and then maybe just expand the first one (index 1 of lines)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Maybe do this? if node:is_expanded() then
for _, raw_line in ipairs(vim.split(node.text, "\n")) do
table.insert(lines, Line({ Text(raw_line) }))
end
end |
Beta Was this translation helpful? Give feedback.
Maybe do this?