Skip to content

Commit

Permalink
fix: repository button being displayed regardless of the configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Apr 27, 2024
1 parent 6ac0239 commit 700e59e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lua/cord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ local function connect(config)
config.text.plugin_manager,
config.text.workspace,
vim.fn.getcwd(),
ffi.new(
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,
config.display.swap_fields
)
end
Expand Down
20 changes: 12 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,18 @@ pub extern "C" fn init(
let workspace_text = ptr_to_string(workspace_text);
let workspace = find_workspace(&ptr_to_string(initial_path));

let buttons = &*buttons_ptr;
let buttons = validate_buttons(
ptr_to_string(buttons.first_label),
ptr_to_string(buttons.first_url),
ptr_to_string(buttons.second_label),
ptr_to_string(buttons.second_url),
workspace.to_str().unwrap(),
);
let buttons = if buttons_ptr.is_null() {
Vec::new()
} else {
let buttons = &*buttons_ptr;
validate_buttons(
ptr_to_string(buttons.first_label),
ptr_to_string(buttons.first_url),
ptr_to_string(buttons.second_label),
ptr_to_string(buttons.second_url),
workspace.to_str().unwrap(),
)
};

std::thread::spawn(move || {
if let Ok(mut client) = RichClient::connect(client_id) {
Expand Down

0 comments on commit 700e59e

Please sign in to comment.