refactor(#2826): winnr->winid consistently
This commit is contained in:
parent
b7e9789850
commit
d6cd465462
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user