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)
4949 end
5050
5151 if target_node then
52- explorer :focus_file (target_node . absolute_path )
52+ explorer :focus_node_or_parent (target_node )
5353 end
5454 end
5555end
Original file line number Diff line number Diff line change @@ -599,14 +599,6 @@ function Explorer:get_node_from_path(path)
599599 :iterate ()
600600end
601601
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-
610602--- Focus node passed as parameter if visible, otherwise focus first visible parent.
611603--- If none of the parents is visible focus root.
612604--- If node is nil do nothing.
@@ -619,7 +611,7 @@ function Explorer:focus_node_or_parent(node)
619611 end )
620612
621613 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 })
623615 break
624616 end
625617
Original file line number Diff line number Diff line change @@ -220,9 +220,9 @@ function LiveFilter:clear_filter()
220220 self .explorer .renderer :draw ()
221221
222222 if node then
223- self .explorer :focus_file (node . absolute_path )
223+ self .explorer :focus_node_or_parent (node )
224224 elseif last_node then
225- self .explorer :focus_file (last_node . absolute_path )
225+ self .explorer :focus_node_or_parent (last_node )
226226 end
227227end
228228
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ function Marks:navigate_select()
263263 if node and not node :is (DirectoryNode ) and not utils .get_win_buf_from_path (node .absolute_path ) then
264264 open_file .fn (" edit" , node .absolute_path )
265265 elseif node then
266- self .explorer :focus_file (node . absolute_path )
266+ self .explorer :focus_node_or_parent (node )
267267 end
268268 end )
269269end
You can’t perform that action at this time.
0 commit comments