refactor(#2826): winnr->winid consistently

This commit is contained in:
Alexander Courtis 2025-06-19 16:46:27 +10:00
parent b7e9789850
commit d6cd465462
2 changed files with 12 additions and 12 deletions

View File

@ -578,18 +578,18 @@ end
---@param winid number|nil ---@param winid number|nil
---@param open_if_closed boolean|nil ---@param open_if_closed boolean|nil
function View:focus(winid, open_if_closed) 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:close(nil, "View:focus")
self:open() 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 elseif open_if_closed and not self:is_visible() then
self:open() self:open()
end end
if wnr then if wid then
vim.api.nvim_set_current_win(wnr) vim.api.nvim_set_current_win(wid)
end end
end end

View File

@ -3,7 +3,7 @@ local globals = require("nvim-tree.globals")
local M = {} local M = {}
--- Debugging only. --- 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. --- Orphans for inexistent tab_ids are shown at the right.
--- lib.target_winid is always shown at the right next to a close button. --- lib.target_winid is always shown at the right next to a close button.
--- Enable with: --- Enable with:
@ -33,10 +33,10 @@ function M.tab_line()
-- tab_id itself -- tab_id itself
tl = tl .. " t" .. tab_id tl = tl .. " t" .. tab_id
-- winnr, if present -- winid, if present
local tp = globals.TABPAGES[tab_id] local tp = globals.TABPAGES[tab_id]
if tp then if tp then
tl = tl .. " w" .. (tp.winnr or "nil") tl = tl .. " w" .. (tp.winid or "nil")
else else
tl = tl .. " " tl = tl .. " "
end end
@ -67,7 +67,7 @@ function M.tab_line()
end end
for tab_id, tp in pairs(tabpages) do for tab_id, tp in pairs(tabpages) do
orphans[tab_id] = orphans[tab_id] or {} orphans[tab_id] = orphans[tab_id] or {}
orphans[tab_id].winnr = tp.winnr orphans[tab_id].winid = tp.winid
end end
-- right-align -- right-align
@ -78,9 +78,9 @@ function M.tab_line()
-- inexistent tab -- inexistent tab
tl = tl .. "%#error#| t" .. tab_id tl = tl .. "%#error#| t" .. tab_id
-- maybe winnr -- maybe winid
if orphan.winnr then if orphan.winid then
tl = tl .. " w" .. (orphan.winnr or "nil") tl = tl .. " w" .. (orphan.winid or "nil")
else else
tl = tl .. " " tl = tl .. " "
end end