revert(#3180, #3177): resolve live filter failures (#3183)

* Revert "fix(#3172): live filter exception (#3173)"

This reverts commit 0a7fcdf3f8.

* Revert "refactor(#2826): move view to instanced window class (#3153)"

This reverts commit 0a06f65bf0.

* feat(#3157): add view.cursorlineopt
This commit is contained in:
Alexander Courtis
2025-08-10 14:45:25 +10:00
committed by GitHub
parent 9b289abd69
commit a4699c0904
35 changed files with 822 additions and 1249 deletions

View File

@@ -1,5 +1,6 @@
local core = require("nvim-tree.core")
local lib = require("nvim-tree.lib")
local view = require("nvim-tree.view")
local finders_find_file = require("nvim-tree.actions.finders.find-file")
local M = {}
@@ -40,12 +41,11 @@ function M.fn(opts)
return
end
local explorer = core.get_explorer()
if explorer and explorer.view:is_visible() then
if view.is_visible() then
-- focus
if opts.focus then
lib.set_target_win()
explorer.view:focus()
view.focus()
end
elseif opts.open then
-- open

View File

@@ -1,5 +1,5 @@
local core = require("nvim-tree.core")
local lib = require("nvim-tree.lib")
local view = require("nvim-tree.view")
local finders_find_file = require("nvim-tree.actions.finders.find-file")
local M = {}
@@ -23,12 +23,10 @@ function M.fn(opts)
opts.path = nil
end
local explorer = core.get_explorer()
if explorer and explorer.view:is_visible() then
if view.is_visible() then
-- focus
lib.set_target_win()
explorer.view:focus()
view.focus()
else
-- open
lib.open({

View File

@@ -1,19 +1,14 @@
local core = require("nvim-tree.core")
local view = require("nvim-tree.view")
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
explorer.view:configure_width()
explorer.view:resize()
view.configure_width()
view.resize()
return
end
@@ -21,19 +16,19 @@ function M.fn(opts)
local width_cfg = options.width
if width_cfg ~= nil then
explorer.view:configure_width(width_cfg)
explorer.view:resize()
view.configure_width(width_cfg)
view.resize()
return
end
if not explorer.view:is_width_determined() then
if not 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
explorer.view:resize(absolute)
view.resize(absolute)
return
end
@@ -44,7 +39,7 @@ function M.fn(opts)
relative_size = "+" .. relative_size
end
explorer.view:resize(relative_size)
view.resize(relative_size)
return
end
end

View File

@@ -1,5 +1,5 @@
local core = require("nvim-tree.core")
local lib = require("nvim-tree.lib")
local view = require("nvim-tree.view")
local finders_find_file = require("nvim-tree.actions.finders.find-file")
local M = {}
@@ -10,8 +10,6 @@ local M = {}
---@param cwd boolean|nil legacy -> opts.path
---@param bang boolean|nil legacy -> opts.update_root
function M.fn(opts, no_focus, cwd, bang)
local explorer = core.get_explorer()
-- legacy arguments
if type(opts) == "boolean" then
opts = {
@@ -42,9 +40,9 @@ function M.fn(opts, no_focus, cwd, bang)
opts.path = nil
end
if explorer and explorer.view:is_visible() then
if view.is_visible() then
-- close
explorer.view:close(nil, "toggle.fn")
view.close()
else
-- open
lib.open({