File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ local M = {
1414}
1515
1616--- Cursor position as per vim.api.nvim_win_get_cursor
17+ --- nil on no explorer or invalid view win
1718--- @return integer[] | nil
1819function M .get_cursor_position ()
1920 if not core .get_explorer () then
3031
3132--- @return Node | nil
3233function M .get_node_at_cursor ()
34+ local explorer = core .get_explorer ()
35+ if not explorer then
36+ return
37+ end
38+
3339 local cursor = M .get_cursor_position ()
3440 if not cursor then
3541 return
3642 end
3743
3844 if cursor [1 ] == 1 and view .is_root_folder_visible (core .get_cwd ()) then
39- return { name = " .. " }
45+ return explorer
4046 end
4147
42- return utils .get_nodes_by_line (core . get_explorer () .nodes , core .get_nodes_starting_line ())[cursor [1 ]]
48+ return utils .get_nodes_by_line (explorer .nodes , core .get_nodes_starting_line ())[cursor [1 ]]
4349end
4450
4551--- Api.tree.get_nodes
You can’t perform that action at this time.
0 commit comments