refacto: add get_nodes_starting_line core util

This commit is contained in:
kiyan
2022-03-26 14:46:44 +01:00
parent 20433ced8a
commit 1831417f05
7 changed files with 20 additions and 14 deletions

View File

@@ -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