Skip to content

Commit eabd08c

Browse files
committed
Fix incorrect open/close indicator state
1 parent 587068c commit eabd08c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lua/nvim-tree/actions/tree/modifiers/expand.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ local function should_expand(expansion_count, node, should_descend)
5353
end
5454

5555
if not dir.open and should_descend(expansion_count, node) then
56-
core.get_explorer():expand(dir) -- populate node.group_next
56+
if #node.nodes == 0 then
57+
core.get_explorer():expand(node) -- populate node.group_next
58+
end
59+
5760
if dir.group_next then
58-
return should_expand(expansion_count, dir.group_next, should_descend)
61+
local expand_next = should_expand(expansion_count, dir.group_next, should_descend)
62+
if expand_next then
63+
dir.open = true
64+
end
65+
return expand_next
5966
else
6067
return true
6168
end

0 commit comments

Comments
 (0)