File tree Expand file tree Collapse file tree 4 files changed +5
-13
lines changed Expand file tree Collapse file tree 4 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function M.fn(direction)
49
49
end
50
50
51
51
if target_node then
52
- explorer :focus_file (target_node . absolute_path )
52
+ explorer :focus_node_or_parent (target_node )
53
53
end
54
54
end
55
55
end
Original file line number Diff line number Diff line change @@ -599,14 +599,6 @@ function Explorer:get_node_from_path(path)
599
599
:iterate ()
600
600
end
601
601
602
- --- @param path string
603
- function Explorer :focus_file (path )
604
- local _ , i = self :find_node (function (node )
605
- return node .absolute_path == path
606
- end )
607
- view .set_cursor ({ i + 1 , 1 })
608
- end
609
-
610
602
--- Focus node passed as parameter if visible, otherwise focus first visible parent.
611
603
--- If none of the parents is visible focus root.
612
604
--- If node is nil do nothing.
@@ -619,7 +611,7 @@ function Explorer:focus_node_or_parent(node)
619
611
end )
620
612
621
613
if found_node or node .parent == nil then
622
- require ( " nvim-tree. view" ) .set_cursor ({ i + 1 , 1 })
614
+ view .set_cursor ({ i + 1 , 1 })
623
615
break
624
616
end
625
617
Original file line number Diff line number Diff line change @@ -220,9 +220,9 @@ function LiveFilter:clear_filter()
220
220
self .explorer .renderer :draw ()
221
221
222
222
if node then
223
- self .explorer :focus_file (node . absolute_path )
223
+ self .explorer :focus_node_or_parent (node )
224
224
elseif last_node then
225
- self .explorer :focus_file (last_node . absolute_path )
225
+ self .explorer :focus_node_or_parent (last_node )
226
226
end
227
227
end
228
228
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ function Marks:navigate_select()
263
263
if node and not node :is (DirectoryNode ) and not utils .get_win_buf_from_path (node .absolute_path ) then
264
264
open_file .fn (" edit" , node .absolute_path )
265
265
elseif node then
266
- self .explorer :focus_file (node . absolute_path )
266
+ self .explorer :focus_node_or_parent (node )
267
267
end
268
268
end )
269
269
end
You can’t perform that action at this time.
0 commit comments