Skip to content

Commit 7bc7043

Browse files
committed
fix: file creation in empty folder without root_folder_label
1 parent c763861 commit 7bc7043

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/nvim-tree/lib.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ function M.get_node_at_cursor()
3030
return { name = ".." }
3131
end
3232

33-
return utils.get_nodes_by_line(core.get_explorer().nodes, core.get_nodes_starting_line())[line]
33+
local nodes_by_line = utils.get_nodes_by_line(core.get_explorer().nodes, core.get_nodes_starting_line())[line]
34+
35+
if nodes_by_line == nil and line == 1 and not view.is_root_folder_visible(core.get_cwd()) then
36+
return { name = ".." }
37+
end
38+
39+
return nodes_by_line
3440
end
3541

3642
---Create a sanitized partial copy of a node, populating children recursively.

0 commit comments

Comments
 (0)