Skip to content

Commit 74040b3

Browse files
authored
fix(common): do not collapse root node with close_node command (#762)
1 parent 08d7cc9 commit 74040b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lua/neo-tree/sources/common/commands.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ M.close_node = function(state, callback)
147147
target_node = parent_node
148148
end
149149

150-
if target_node and target_node:has_children() then
150+
local root = tree:get_nodes()[1]
151+
local is_root = target_node:get_id() == root:get_id()
152+
153+
if target_node and target_node:has_children() and not is_root then
151154
target_node:collapse()
152155
renderer.redraw(state)
153156
renderer.focus_node(state, target_node:get_id())

0 commit comments

Comments
 (0)