Skip to content

Commit

Permalink
fix(tabpages): renaming bug on reopened tab (#877)
Browse files Browse the repository at this point in the history
vim.fn.tabpagenr gets the tab number but api.nvim_tabpage_set_var
expects tab id, meaning the tab rename would fail if a tab was closed
and reopened. This change passes 0 into api.nvim_tabpage_set_var
which will use the current focused tab without needing to retrieve
the id.
  • Loading branch information
codopanda committed Mar 7, 2024
1 parent 615aeb0 commit 1064399
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lua/bufferline/tabpages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ local function render(tabpage, is_active, style, highlights)
end

function M.rename_tab(tabnr, name)
if tabnr == 0 then tabnr = vim.fn.tabpagenr() end
if name == "" then name = tostring(tabnr) end
api.nvim_tabpage_set_var(tabnr, "name", name)
api.nvim_tabpage_set_var(0, "name", name)
ui.refresh()
end

Expand Down

0 comments on commit 1064399

Please sign in to comment.