Skip to content

Commit daf27a8

Browse files
committed
tidy group methods
1 parent 307ead2 commit daf27a8

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

lua/nvim-tree/node/directory.lua

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,6 @@ function DirectoryNode:single_child_directory()
146146
end
147147
end
148148

149-
---@private
150-
---@return Node[]
151-
function DirectoryNode:get_all_nodes_in_group()
152-
local next_node = self:group_parent_or_node()
153-
local nodes = {}
154-
while next_node do
155-
table.insert(nodes, next_node)
156-
next_node = next_node.group_next
157-
end
158-
return nodes
159-
end
160-
161149
---@private
162150
-- Toggle group empty folders
163151
function DirectoryNode:toggle_group_folders()
@@ -219,8 +207,11 @@ function DirectoryNode:expand_or_collapse(toggle_group)
219207
else
220208
next_open = not open
221209
end
222-
for _, n in ipairs(head_node:get_all_nodes_in_group()) do
223-
n.open = next_open
210+
211+
local node = self
212+
while node do
213+
node.open = next_open
214+
node = node.group_next
224215
end
225216

226217
self.explorer.renderer:draw()

0 commit comments

Comments
 (0)