From d6cd465462890e473e8ace7cce5f9bcc14cdbe8b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Thu, 19 Jun 2025 16:46:27 +1000 Subject: [PATCH] refactor(#2826): winnr->winid consistently --- lua/nvim-tree/explorer/view.lua | 10 +++++----- lua/nvim-tree/multi-instance-debug.lua | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/nvim-tree/explorer/view.lua b/lua/nvim-tree/explorer/view.lua index f0465192..896a5b66 100644 --- a/lua/nvim-tree/explorer/view.lua +++ b/lua/nvim-tree/explorer/view.lua @@ -578,18 +578,18 @@ end ---@param winid number|nil ---@param open_if_closed boolean|nil function View:focus(winid, open_if_closed) - local wnr = winid or self:get_winid(nil, "View:focus1") + local wid = winid or self:get_winid(nil, "View:focus1") - if vim.api.nvim_win_get_tabpage(wnr or 0) ~= vim.api.nvim_win_get_tabpage(0) then + if vim.api.nvim_win_get_tabpage(wid or 0) ~= vim.api.nvim_win_get_tabpage(0) then self:close(nil, "View:focus") self:open() - wnr = self:get_winid(nil, "View:focus2") + wid = self:get_winid(nil, "View:focus2") elseif open_if_closed and not self:is_visible() then self:open() end - if wnr then - vim.api.nvim_set_current_win(wnr) + if wid then + vim.api.nvim_set_current_win(wid) end end diff --git a/lua/nvim-tree/multi-instance-debug.lua b/lua/nvim-tree/multi-instance-debug.lua index 5b460483..d33f34a1 100644 --- a/lua/nvim-tree/multi-instance-debug.lua +++ b/lua/nvim-tree/multi-instance-debug.lua @@ -3,7 +3,7 @@ local globals = require("nvim-tree.globals") local M = {} --- Debugging only. ---- Tabs show TABPAGES winnr and BUFNR_PER_TAB bufnr for the tab. +--- Tabs show TABPAGES winid and BUFNR_PER_TAB bufnr for the tab. --- Orphans for inexistent tab_ids are shown at the right. --- lib.target_winid is always shown at the right next to a close button. --- Enable with: @@ -33,10 +33,10 @@ function M.tab_line() -- tab_id itself tl = tl .. " t" .. tab_id - -- winnr, if present + -- winid, if present local tp = globals.TABPAGES[tab_id] if tp then - tl = tl .. " w" .. (tp.winnr or "nil") + tl = tl .. " w" .. (tp.winid or "nil") else tl = tl .. " " end @@ -67,7 +67,7 @@ function M.tab_line() end for tab_id, tp in pairs(tabpages) do orphans[tab_id] = orphans[tab_id] or {} - orphans[tab_id].winnr = tp.winnr + orphans[tab_id].winid = tp.winid end -- right-align @@ -78,9 +78,9 @@ function M.tab_line() -- inexistent tab tl = tl .. "%#error#| t" .. tab_id - -- maybe winnr - if orphan.winnr then - tl = tl .. " w" .. (orphan.winnr or "nil") + -- maybe winid + if orphan.winid then + tl = tl .. " w" .. (orphan.winid or "nil") else tl = tl .. " " end