File tree 1 file changed +18
-6
lines changed 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 74
74
75
75
-- If node is grouped, return the last node in the group. Otherwise, return the given node.
76
76
function M .get_last_group_node (node )
77
- local next = node
78
- while next .group_next do
79
- next = next .group_next
77
+ local next_node = node
78
+ while next_node .group_next do
79
+ next_node = next_node .group_next
80
80
end
81
- return next
81
+ return next_node
82
+ end
83
+
84
+ function M .get_all_nodes_in_group (node )
85
+ local next_node = utils .get_parent_of_group (node )
86
+ local nodes = {}
87
+ while next_node do
88
+ table.insert (nodes , next_node )
89
+ next_node = next_node .group_next
90
+ end
91
+ return nodes
82
92
end
83
93
84
94
function M .expand_or_collapse (node )
@@ -90,8 +100,10 @@ function M.expand_or_collapse(node)
90
100
core .get_explorer ():expand (node )
91
101
end
92
102
93
- node = M .get_last_group_node (node )
94
- node .open = not node .open
103
+ local open = not M .get_last_group_node (node ).open
104
+ for _ , n in ipairs (M .get_all_nodes_in_group (node )) do
105
+ n .open = open
106
+ end
95
107
96
108
renderer .draw ()
97
109
end
You can’t perform that action at this time.
0 commit comments