* refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class, WIP * refactor(#2826): singleton View class * refactor(#2826): View is an Explorer member * refactor(#2826): move autocmds to Explorer * refactor(#2826): API uses Explorer's View * refactor(#2826): move View into Explorer package * refactor(#2826): retain necessary view globals * refactor(#2826): move all winhl to appearance constants * refactor(#2826): add lifecycle logging to all Explorer members * refactor(#2826): fix bad cherry-pick * refactor(#2826): better enumerate_options function * refactor(#2826): add View.tab_line for debugging * refactor(#2826): default lifecycle log off * refactor(#2826): add experimental.multi_instance_debug, split globals out of view, move diagnostics to its own module * refactor(#2826): instrument View:get_winnr * refactor(#2826): instrument View:setup_tabpage * refactor(#2826): instrument View:set_current_win, View:prevent_buffer_override * refactor(#2826): instrument View:get_bufnr * refactor(#2826): track member bufnr -> winid with global * refactor(#2826): tidy experiment names and logs * vim: nvim-tree: track bufnr via buffer-update channel * vim: nvim-tree: more logging * vim: nvim-tree: revert: track bufnr via buffer-update channel * refactor(#2826): notify error on view winid and bufnr mismatches * refactor(#2826): notify error on view winid and bufnr mismatches * refactor(#2826): explorer init logging
This commit is contained in:
committed by
GitHub
parent
d54a1875a9
commit
0a06f65bf0
@@ -1,14 +1,19 @@
|
||||
local view = require("nvim-tree.view")
|
||||
local core = require("nvim-tree.core")
|
||||
|
||||
local M = {}
|
||||
|
||||
---Resize the tree, persisting the new size.
|
||||
---@param opts ApiTreeResizeOpts|nil
|
||||
function M.fn(opts)
|
||||
local explorer = core.get_explorer()
|
||||
if not explorer then
|
||||
return
|
||||
end
|
||||
|
||||
if opts == nil then
|
||||
-- reset to config values
|
||||
view.configure_width()
|
||||
view.resize()
|
||||
explorer.view:configure_width()
|
||||
explorer.view:resize()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -16,19 +21,19 @@ function M.fn(opts)
|
||||
local width_cfg = options.width
|
||||
|
||||
if width_cfg ~= nil then
|
||||
view.configure_width(width_cfg)
|
||||
view.resize()
|
||||
explorer.view:configure_width(width_cfg)
|
||||
explorer.view:resize()
|
||||
return
|
||||
end
|
||||
|
||||
if not view.is_width_determined() then
|
||||
if not explorer.view:is_width_determined() then
|
||||
-- {absolute} and {relative} do nothing when {width} is a function.
|
||||
return
|
||||
end
|
||||
|
||||
local absolute = options.absolute
|
||||
if type(absolute) == "number" then
|
||||
view.resize(absolute)
|
||||
explorer.view:resize(absolute)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -39,7 +44,7 @@ function M.fn(opts)
|
||||
relative_size = "+" .. relative_size
|
||||
end
|
||||
|
||||
view.resize(relative_size)
|
||||
explorer.view:resize(relative_size)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user