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: Disabling show_repository also hides the other buttons #62

Merged
merged 1 commit into from
Jun 13, 2024
Merged
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
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