* Revert "fix(#3172): live filter exception (#3173)" This reverts commit0a7fcdf3f8. * Revert "refactor(#2826): move view to instanced window class (#3153)" This reverts commit0a06f65bf0. * feat(#3157): add view.cursorlineopt
This commit is contained in:
committed by
GitHub
parent
9b289abd69
commit
a4699c0904
@@ -1,5 +1,6 @@
|
||||
local notify = require("nvim-tree.notify")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local view = require("nvim-tree.view")
|
||||
|
||||
local Class = require("nvim-tree.classic")
|
||||
|
||||
@@ -378,7 +379,7 @@ end
|
||||
|
||||
---@private
|
||||
function Builder:build_header()
|
||||
if self.explorer.view:is_root_folder_visible(self.explorer.absolute_path) then
|
||||
if view.is_root_folder_visible(self.explorer.absolute_path) then
|
||||
local root_name = self:format_root_name(self.explorer.opts.renderer.root_folder_label)
|
||||
table.insert(self.lines, root_name)
|
||||
self:insert_highlight({ "NvimTreeRootFolder" }, 0, string.len(root_name))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local appearance = require("nvim-tree.appearance")
|
||||
local utils = require("nvim-tree.utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
local utils = require("nvim-tree.utils")
|
||||
local view = require("nvim-tree.view")
|
||||
|
||||
local function hide(win)
|
||||
if win then
|
||||
if vim.api.nvim_win_is_valid(win) then
|
||||
@@ -72,7 +72,7 @@ local function show(opts)
|
||||
style = "minimal",
|
||||
border = "none"
|
||||
})
|
||||
vim.wo[M.popup_win].winhl = appearance.WIN_HL
|
||||
vim.wo[M.popup_win].winhl = view.View.winopts.winhl
|
||||
|
||||
local ns_id = vim.api.nvim_get_namespaces()["NvimTreeHighlights"]
|
||||
local extmarks = vim.api.nvim_buf_get_extmarks(0, ns_id, { line_nr - 1, 0 }, { line_nr - 1, -1 }, { details = true })
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local log = require("nvim-tree.log")
|
||||
local view = require("nvim-tree.view")
|
||||
local events = require("nvim-tree.events")
|
||||
|
||||
local Class = require("nvim-tree.classic")
|
||||
@@ -25,15 +26,9 @@ local Renderer = Class:extend()
|
||||
---@protected
|
||||
---@param args RendererArgs
|
||||
function Renderer:new(args)
|
||||
args.explorer:log_new("Renderer")
|
||||
|
||||
self.explorer = args.explorer
|
||||
end
|
||||
|
||||
function Renderer:destroy()
|
||||
self.explorer:log_destroy("Renderer")
|
||||
end
|
||||
|
||||
---@private
|
||||
---@param bufnr number
|
||||
---@param lines string[]
|
||||
@@ -101,28 +96,28 @@ function Renderer:render_hl(bufnr, hl_range_args)
|
||||
end
|
||||
|
||||
function Renderer:draw()
|
||||
local bufnr = self.explorer.view:get_bufnr("Renderer:draw")
|
||||
local bufnr = view.get_bufnr()
|
||||
if not bufnr or not vim.api.nvim_buf_is_loaded(bufnr) then
|
||||
return
|
||||
end
|
||||
|
||||
local profile = log.profile_start("draw")
|
||||
|
||||
local cursor = vim.api.nvim_win_get_cursor(self.explorer.view:get_winnr(nil, "Renderer:draw1") or 0)
|
||||
local cursor = vim.api.nvim_win_get_cursor(view.get_winnr() or 0)
|
||||
|
||||
local builder = Builder(self.explorer):build()
|
||||
|
||||
self:_draw(bufnr, builder.lines, builder.hl_range_args, builder.signs, builder.extmarks, builder.virtual_lines)
|
||||
|
||||
if cursor and #builder.lines >= cursor[1] then
|
||||
vim.api.nvim_win_set_cursor(self.explorer.view:get_winnr(nil, "Renderer:draw2") or 0, cursor)
|
||||
vim.api.nvim_win_set_cursor(view.get_winnr() or 0, cursor)
|
||||
end
|
||||
|
||||
self.explorer.view:grow_from_content()
|
||||
view.grow_from_content()
|
||||
|
||||
log.profile_end(profile)
|
||||
|
||||
events._dispatch_on_tree_rendered(bufnr, self.explorer.view:get_winnr(nil, "Renderer:draw3"))
|
||||
events._dispatch_on_tree_rendered(bufnr, view.get_winnr())
|
||||
end
|
||||
|
||||
return Renderer
|
||||
|
||||
Reference in New Issue
Block a user