Skip to content

Commit

Permalink
fix: button = '' causes strange layout
Browse files Browse the repository at this point in the history
In some cases `button = ''` was interpreted as: "`''` is the `button` ",
not "there is no button", as such the layout was being adjusted as if it
was there.
  • Loading branch information
Iron-E committed Apr 2, 2023
1 parent cec8397 commit 7d2cf79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/barbar/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Layout.calculate_buffer_width(bufnr, index)
end)

local button = icons_option.button
if button then
if button and #button > 0 then
width = width + strwidth(button) + SPACE_LEN
end

Expand Down
2 changes: 1 addition & 1 deletion lua/barbar/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ local function generate_tabline(bufnrs, refocus)
local button = {hl = buffer_hl, text = ''}

local button_icon = icons_option.button
if button_icon and #button_icon > 1 then
if button_icon and #button_icon > 0 then
button.text = button_icon .. ' '

if click_enabled then
Expand Down

0 comments on commit 7d2cf79

Please sign in to comment.