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,3 +1,4 @@
local view = require("nvim-tree.view")
local core = require("nvim-tree.core")
local notify = require("nvim-tree.notify")
@@ -11,11 +12,9 @@ local M = {
}
function M.set_target_win()
local explorer = core.get_explorer()
local id = vim.api.nvim_get_current_win()
if explorer and id == explorer.view:get_winnr(nil, "lib.set_target_win") then
local tree_id = view.get_winnr()
if tree_id and id == tree_id then
M.target_winid = 0
return
end
@@ -31,16 +30,11 @@ local function handle_buf_cwd(cwd)
end
local function open_view_and_draw()
local explorer = core.get_explorer()
local cwd = vim.fn.getcwd()
if explorer then
explorer.view:open()
end
view.open()
handle_buf_cwd(cwd)
local explorer = core.get_explorer()
if explorer then
explorer.renderer:draw()
end
@@ -102,42 +96,39 @@ function M.open(opts)
M.set_target_win()
if not core.get_explorer() or opts.path then
if opts.path then
core.init(opts.path, "lib.open - opts.path")
core.init(opts.path)
else
local cwd, err = vim.loop.cwd()
if not cwd then
notify.error(string.format("current working directory unavailable: %s", err))
return
end
core.init(cwd, "lib.open - cwd")
core.init(cwd)
end
end
local explorer = core.get_explorer()
if should_hijack_current_buf() then
view.close_this_tab_only()
view.open_in_win()
if explorer then
explorer.view:close_this_tab_only()
explorer.view:open_in_win()
explorer.renderer:draw()
end
elseif opts.winid then
view.open_in_win({ hijack_current_buf = false, resize = false, winid = opts.winid })
if explorer then
explorer.view:open_in_win({ hijack_current_buf = false, resize = false, winid = opts.winid })
explorer.renderer:draw()
end
elseif opts.current_window then
view.open_in_win({ hijack_current_buf = false, resize = false })
if explorer then
explorer.view:open_in_win({ hijack_current_buf = false, resize = false })
explorer.renderer:draw()
end
else
open_view_and_draw()
end
if explorer then
explorer.view:restore_tab_state()
end
view.restore_tab_state()
end
function M.setup(opts)