fixup: fix bugs in tabs component

- fix options nil error upon deleting and creating tab
- fix only single tab being rendered after deleting and recreating tabs
This commit is contained in:
shadmansaleh 2021-10-08 20:27:12 +06:00
parent 98b43ba3a1
commit 9bf5ecc2bb
1 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,7 @@ function Tabs:update_status()
for t = 1, vim.fn.tabpagenr '$' do
tabs[#tabs + 1] = Tab:new { tabnr = t, options = self.options, highlights = self.highlights }
end
local current = vim.api.nvim_get_current_tabpage()
local current = vim.fn.tabpagenr()
tabs[1].first = true
tabs[#tabs].last = true
if tabs[current] then
@ -157,7 +157,7 @@ function Tabs:update_status()
end
local current_tab = tabs[current]
if current_tab == nil then
local t = Tab:new { tabnr = vim.fn.tabpagenr() }
local t = Tab:new { tabnr = vim.fn.tabpagenr(), options = self.options, highlights = self.highlights }
t.current = true
t.last = true
data[#data + 1] = t:render()