Skip to content

Commit

Permalink
fix(fold): start folding with closest non leaf node. Fixes #420
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 971ad92 commit f248c69
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/trouble/view/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function M:fold(node, opts)
self.foldenable = true
opts = opts or {}
local action = opts.action or "toggle"
if node:is_leaf() and node.parent then
node = node.parent
end
local id = node.id
if action == "toggle" then
if self._folded[id] then
Expand Down

0 comments on commit f248c69

Please sign in to comment.