Skip to content

Commit

Permalink
fix: disabling show_repository also hides the other buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Jun 13, 2024
1 parent c94361f commit edcea53
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions lua/cord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ local function init(config)
config.display.workspace_blacklist
)

local first_url = config.buttons[1] and config.buttons[1].url
local second_url = config.buttons[2] and config.buttons[2].url

if
not first_url or first_url == 'git' and not config.display.show_repository
then
first_url = ''
end

if
not second_url
or second_url == 'git' and not config.display.show_repository
then
second_url = ''
end

return discord.init(
ffi.new(
'InitArgs',
Expand All @@ -90,15 +106,13 @@ local function init(config)
vim.fn.getcwd(),
config.display.swap_fields
),
config.display.show_repository
and ffi.new(
'Buttons',
(config.buttons[1] and config.buttons[1].label) or '',
(config.buttons[1] and config.buttons[1].url) or '',
(config.buttons[2] and config.buttons[2].label) or '',
(config.buttons[2] and config.buttons[2].url) or ''
)
or nil
ffi.new(
'Buttons',
(config.buttons[1] and config.buttons[1].label) or '',
first_url,
(config.buttons[2] and config.buttons[2].label) or '',
second_url
)
)
end

Expand Down

0 comments on commit edcea53

Please sign in to comment.