Skip to content

Commit 0feab00

Browse files
committed
fix(#1723): find_file for externally created new file results in folder unable to be opened
1 parent 2692733 commit 0feab00

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lua/nvim-tree/actions/finders/find-file.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ function M.fn(fname)
2626
running[fname] = true
2727

2828
local ps = log.profile_start("find file %s", fname)
29-
local line = core.get_nodes_starting_line()
29+
30+
-- first line is the root node
31+
local line = core.get_nodes_starting_line() - 1
3032

3133
local absolute_paths_searched = {}
3234

33-
local found = Iterator.builder(core.get_explorer().nodes)
35+
local found = Iterator.builder({ core.get_explorer() })
3436
:matcher(function(node)
3537
return node.absolute_path == fname_real or node.link_to == fname_real
3638
end)
@@ -47,9 +49,7 @@ function M.fn(fname)
4749

4850
if abs_match or link_match then
4951
node.open = true
50-
if #node.nodes == 0 then
51-
core.get_explorer():expand(node)
52-
end
52+
core.get_explorer():expand(node)
5353
end
5454
end)
5555
:recursor(function(node)

0 commit comments

Comments
 (0)