File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
lua/nvim-tree/actions/finders Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,24 @@ function M.fn(fname)
27
27
28
28
local line = core .get_nodes_starting_line ()
29
29
30
+ local absolute_paths_searched = {}
31
+
30
32
local found = Iterator .builder (core .get_explorer ().nodes )
31
33
:matcher (function (node )
32
34
return node .absolute_path == fname_real or node .link_to == fname_real
33
35
end )
34
36
:applier (function (node )
35
37
line = line + 1
36
- if vim .startswith (fname_real , node .absolute_path .. utils .path_separator ) then
38
+
39
+ if vim .tbl_contains (absolute_paths_searched , node .absolute_path ) then
40
+ return
41
+ end
42
+ table.insert (absolute_paths_searched , node .absolute_path )
43
+
44
+ local abs_match = vim .startswith (fname_real , node .absolute_path .. utils .path_separator )
45
+ local link_match = node .link_to and vim .startswith (fname_real , node .link_to .. utils .path_separator )
46
+
47
+ if abs_match or link_match then
37
48
node .open = true
38
49
if # node .nodes == 0 then
39
50
core .get_explorer ():expand (node )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ local find_file = require("nvim-tree.actions.finders.find-file").fn
8
8
local M = {}
9
9
10
10
local function search (search_dir , input_path )
11
- local realpaths = {}
11
+ local realpaths_searched = {}
12
12
13
13
if not search_dir then
14
14
return
@@ -23,10 +23,10 @@ local function search(search_dir, input_path)
23
23
end
24
24
25
25
realpath , _ = uv .fs_realpath (dir )
26
- if not realpath or vim .tbl_contains (realpaths , realpath ) then
26
+ if not realpath or vim .tbl_contains (realpaths_searched , realpath ) then
27
27
return
28
28
end
29
- table.insert (realpaths , realpath )
29
+ table.insert (realpaths_searched , realpath )
30
30
31
31
name , _ = uv .fs_scandir_next (handle )
32
32
while name do
@@ -43,7 +43,7 @@ local function search(search_dir, input_path)
43
43
end
44
44
45
45
if stat .type == " directory" then
46
- path = iter (path , input_path )
46
+ path = iter (path )
47
47
if path then
48
48
return path
49
49
end
You can’t perform that action at this time.
0 commit comments