File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ local keymap = require("nvim-tree.keymap")
1010local notify = require (" nvim-tree.notify" )
1111
1212local DirectoryNode = require (" nvim-tree.node.directory" )
13+ local RootNode = require (" nvim-tree.node.root" )
1314
1415local Api = {
1516 tree = {},
@@ -137,9 +138,9 @@ Api.tree.change_root = wrap(function(...)
137138end )
138139
139140Api .tree .change_root_to_node = wrap_node (function (node )
140- if node .name == " .." then
141+ if node .name == " .." or node : is ( RootNode ) then
141142 actions .root .change_dir .fn (" .." )
142- elseif node . nodes ~= nil then
143+ elseif node : is ( DirectoryNode ) then
143144 actions .root .change_dir .fn (node :last_group_node ().absolute_path )
144145 end
145146end )
Original file line number Diff line number Diff line change @@ -70,14 +70,6 @@ function Node:is_dotfile()
7070 return false
7171end
7272
73- --- Return self, should only be called on a DirectoryNode
74- --- TODO #2886 remove method or leave in place, warn if practical and non too intrusive
75- --- @return Node
76- function Node :last_group_node ()
77- error (string.format (" \n Node:last_group_node called for '%s'" , self .absolute_path ))
78- return self
79- end
80-
8173--- @param project table ?
8274--- @param root string ?
8375function Node :update_parent_statuses (project , root )
You can’t perform that action at this time.
0 commit comments