File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ local M = {
14
14
}
15
15
16
16
--- Cursor position as per vim.api.nvim_win_get_cursor
17
+ --- nil on no explorer or invalid view win
17
18
--- @return integer[] | nil
18
19
function M .get_cursor_position ()
19
20
if not core .get_explorer () then
30
31
31
32
--- @return Node | nil
32
33
function M .get_node_at_cursor ()
34
+ local explorer = core .get_explorer ()
35
+ if not explorer then
36
+ return
37
+ end
38
+
33
39
local cursor = M .get_cursor_position ()
34
40
if not cursor then
35
41
return
36
42
end
37
43
38
44
if cursor [1 ] == 1 and view .is_root_folder_visible (core .get_cwd ()) then
39
- return { name = " .. " }
45
+ return explorer
40
46
end
41
47
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 ]]
43
49
end
44
50
45
51
--- Api.tree.get_nodes
You can’t perform that action at this time.
0 commit comments