Skip to content

Commit 3615c7d

Browse files
committed
refactor(#2826): temporarily reuse BUFNR_PER_TAB in view constructor
1 parent 5fbd674 commit 3615c7d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lua/nvim-tree/explorer/view.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ local View = Class:extend()
3232
function View:new(args)
3333
args.explorer:log_new("View")
3434

35-
self.explorer = args.explorer
36-
self.adaptive_size = false
37-
self.side = (self.explorer.opts.view.side == "right") and "right" or "left"
38-
self.live_filter = { prev_focused_node = nil, }
39-
self.bufnr_by_tab = {}
35+
self.explorer = args.explorer
36+
self.adaptive_size = false
37+
self.side = (self.explorer.opts.view.side == "right") and "right" or "left"
38+
self.live_filter = { prev_focused_node = nil, }
39+
self.bufnr_by_tab = {}
4040

41-
self.winopts = {
41+
self.winopts = {
4242
relativenumber = self.explorer.opts.view.relativenumber,
4343
number = self.explorer.opts.view.number,
4444
list = false,
@@ -59,6 +59,10 @@ function View:new(args)
5959

6060
self:configure_width(self.explorer.opts.view.width)
6161
self.initial_width = self:get_width()
62+
63+
-- TODO multi-instance remove this; delete buffers rather than retaining them
64+
local tabid = vim.api.nvim_get_current_tabpage()
65+
self.bufnr_by_tab[tabid] = globals.BUFNR_PER_TAB[tabid]
6266
end
6367

6468
function View:destroy()

0 commit comments

Comments
 (0)