refacto: add get_nodes_starting_line core util
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
local events = require "nvim-tree.events"
|
||||
local explorer = require "nvim-tree.explorer"
|
||||
local view = require "nvim-tree.view"
|
||||
|
||||
local M = {}
|
||||
|
||||
local first_init_done = false
|
||||
|
||||
TreeExplorer = nil
|
||||
local first_init_done = false
|
||||
|
||||
function M.init(foldername)
|
||||
TreeExplorer = explorer.Explorer.new(foldername)
|
||||
@@ -23,4 +23,12 @@ function M.get_cwd()
|
||||
return TreeExplorer.cwd
|
||||
end
|
||||
|
||||
function M.get_nodes_starting_line()
|
||||
local offset = 1
|
||||
if view.is_root_folder_visible(M.get_cwd()) then
|
||||
offset = offset + 1
|
||||
end
|
||||
return offset
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user