Skip to content

Commit 0037e1b

Browse files
committed
View revert to globals.BUFNR_BY_TABID until bufnr and winid are tracked for the view
1 parent 73849d9 commit 0037e1b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lua/nvim-tree/explorer/view.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ function View:new(args)
6060

6161
self:configure_width(self.explorer.opts.view.width)
6262
self.initial_width = self:get_width()
63-
64-
-- TODO multi-instance remove this; delete buffers rather than retaining them
65-
local tabid = vim.api.nvim_get_current_tabpage()
66-
self.bufnr_by_tabid[tabid] = globals.BUFNR_BY_TABID[tabid]
6763
end
6864

6965
function View:destroy()
@@ -161,7 +157,6 @@ function View:create_buffer(bufnr)
161157

162158
-- set both bufnr registries
163159
globals.BUFNR_BY_TABID[tabid] = bufnr
164-
self.bufnr_by_tabid[tabid] = bufnr
165160

166161
vim.api.nvim_buf_set_name(bufnr, "NvimTree_" .. tabid)
167162

@@ -498,7 +493,6 @@ function View:abandon_current_window()
498493
local tab = vim.api.nvim_get_current_tabpage()
499494

500495
globals.BUFNR_BY_TABID[tab] = nil
501-
self.bufnr_by_tabid[tab] = nil
502496

503497
globals.WINID_BY_TABID[tab] = nil
504498
end
@@ -582,7 +576,7 @@ end
582576
---@param tabid number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage.
583577
---@return integer? winid
584578
function View:winid(tabid)
585-
local bufnr = self.bufnr_by_tabid[tabid]
579+
local bufnr = globals.BUFNR_BY_TABID[tabid]
586580

587581
if bufnr then
588582
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(tabid or 0)) do
@@ -607,7 +601,7 @@ end
607601
function View:get_bufnr()
608602
local tab = vim.api.nvim_get_current_tabpage()
609603

610-
return self.bufnr_by_tabid[tab]
604+
return globals.BUFNR_BY_TABID[tabd]
611605
end
612606

613607
function View:prevent_buffer_override()

0 commit comments

Comments
 (0)