From 0037e1b855786c2a0bdc38281a11180c2dd6e58b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Tue, 29 Jul 2025 12:41:47 +1000 Subject: [PATCH] View revert to globals.BUFNR_BY_TABID until bufnr and winid are tracked for the view --- lua/nvim-tree/explorer/view.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lua/nvim-tree/explorer/view.lua b/lua/nvim-tree/explorer/view.lua index 4f88443c..d2c1186a 100644 --- a/lua/nvim-tree/explorer/view.lua +++ b/lua/nvim-tree/explorer/view.lua @@ -60,10 +60,6 @@ function View:new(args) self:configure_width(self.explorer.opts.view.width) self.initial_width = self:get_width() - - -- TODO multi-instance remove this; delete buffers rather than retaining them - local tabid = vim.api.nvim_get_current_tabpage() - self.bufnr_by_tabid[tabid] = globals.BUFNR_BY_TABID[tabid] end function View:destroy() @@ -161,7 +157,6 @@ function View:create_buffer(bufnr) -- set both bufnr registries globals.BUFNR_BY_TABID[tabid] = bufnr - self.bufnr_by_tabid[tabid] = bufnr vim.api.nvim_buf_set_name(bufnr, "NvimTree_" .. tabid) @@ -498,7 +493,6 @@ function View:abandon_current_window() local tab = vim.api.nvim_get_current_tabpage() globals.BUFNR_BY_TABID[tab] = nil - self.bufnr_by_tabid[tab] = nil globals.WINID_BY_TABID[tab] = nil end @@ -582,7 +576,7 @@ end ---@param tabid number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage. ---@return integer? winid function View:winid(tabid) - local bufnr = self.bufnr_by_tabid[tabid] + local bufnr = globals.BUFNR_BY_TABID[tabid] if bufnr then for _, winid in pairs(vim.api.nvim_tabpage_list_wins(tabid or 0)) do @@ -607,7 +601,7 @@ end function View:get_bufnr() local tab = vim.api.nvim_get_current_tabpage() - return self.bufnr_by_tabid[tab] + return globals.BUFNR_BY_TABID[tabd] end function View:prevent_buffer_override()