From 10643990c33ca295bfe970d775c6e7697354aa0f Mon Sep 17 00:00:00 2001 From: codopanda <159239255+codopanda@users.noreply.github.com> Date: Thu, 7 Mar 2024 04:57:20 -0500 Subject: [PATCH] fix(tabpages): renaming bug on reopened tab (#877) 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. --- lua/bufferline/tabpages.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/bufferline/tabpages.lua b/lua/bufferline/tabpages.lua index bfbf4d4f..25b4b0a4 100644 --- a/lua/bufferline/tabpages.lua +++ b/lua/bufferline/tabpages.lua @@ -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