Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix visible tabs #266

Open
wants to merge 3 commits into
base: v3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lua/nvchad/tabufline/modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local strep = string.rep
local style_buf = require("nvchad.tabufline.utils").style_buf
local cur_buf = api.nvim_get_current_buf
local config = require("nvconfig").ui.tabufline
local BUF_WIDTH = 21

---------------------------------------------------------- btn onclick functions ----------------------------------------------

Expand Down Expand Up @@ -62,7 +63,7 @@ M.buffers = function()
local has_current = false -- have we seen current buffer yet?

for i, nr in ipairs(vim.t.bufs) do
if ((#buffers + 1) * 23) > available_space() then
if ((#buffers + 1) * BUF_WIDTH) > available_space() then
if has_current then
break
end
Expand All @@ -71,7 +72,7 @@ M.buffers = function()
end

has_current = cur_buf() == nr or has_current
table.insert(buffers, style_buf(nr, i))
table.insert(buffers, style_buf(nr, i, BUF_WIDTH))
end

return table.concat(buffers) .. txt("%=", "Fill") -- buffers + empty space
Expand Down
4 changes: 2 additions & 2 deletions lua/nvchad/tabufline/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ local function gen_unique_name(oldname, index)
end
end

M.style_buf = function(nr, i)
M.style_buf = function(nr, i, width)
-- add fileicon + name
local icon = "󰈚"
local is_curbuf = cur_buf() == nr
Expand All @@ -61,7 +61,7 @@ M.style_buf = function(nr, i)
end

-- padding around bufname; 15= maxnamelen + 2 icon & space + 2 close icon
local pad = math.floor((23 - #name - 5) / 2)
local pad = math.floor((width - #name - 5) / 2)
pad = pad <= 0 and 1 or pad

local maxname_len = 15
Expand Down