move lib.get_node_at_cursor to Explorer
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
local view = require("nvim-tree.view")
|
||||
local core = require("nvim-tree.core")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local events = require("nvim-tree.events")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
@@ -13,25 +12,6 @@ local M = {
|
||||
target_winid = nil,
|
||||
}
|
||||
|
||||
---@return Node|nil
|
||||
function M.get_node_at_cursor()
|
||||
local explorer = core.get_explorer()
|
||||
if not explorer then
|
||||
return
|
||||
end
|
||||
|
||||
local cursor = explorer:get_cursor_position()
|
||||
if not cursor then
|
||||
return
|
||||
end
|
||||
|
||||
if cursor[1] == 1 and view.is_root_folder_visible(core.get_cwd()) then
|
||||
return explorer
|
||||
end
|
||||
|
||||
return utils.get_nodes_by_line(explorer.nodes, core.get_nodes_starting_line())[cursor[1]]
|
||||
end
|
||||
|
||||
---Api.tree.get_nodes
|
||||
---@return Node[]?
|
||||
function M.get_nodes()
|
||||
|
||||
Reference in New Issue
Block a user