From d85a6db6a3f1115d60cea103d33944894a2b2d4c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 18 Sep 2025 10:22:26 +0200 Subject: [PATCH] git_ui: Use margin instead of padding for blame entries (#38397) This makes the hover background change keep a visible border element between the gutter and blame entries Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/git_ui/src/blame_ui.rs | 139 ++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/crates/git_ui/src/blame_ui.rs b/crates/git_ui/src/blame_ui.rs index ad5823c1674353f2e0531e5f71e1420fe464bfe6..6229c80c739ee73b20fe2640f30f9f751a1b4411 100644 --- a/crates/git_ui/src/blame_ui.rs +++ b/crates/git_ui/src/blame_ui.rs @@ -47,75 +47,84 @@ impl BlameRenderer for GitBlameRenderer { let name = util::truncate_and_trailoff(author_name, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED); Some( - h_flex() - .w_full() - .justify_between() - .font_family(style.font().family) - .line_height(style.line_height) - .id(("blame", ix)) - .text_color(cx.theme().status().hint) - .pr_2() - .gap_2() + div() + .mr_2() .child( h_flex() - .items_center() + .w_full() + .justify_between() + .font_family(style.font().family) + .line_height(style.line_height) + .id(("blame", ix)) + .text_color(cx.theme().status().hint) .gap_2() - .child(div().text_color(sha_color).child(short_commit_id)) - .child(name), - ) - .child(relative_timestamp) - .hover(|style| style.bg(cx.theme().colors().element_hover)) - .cursor_pointer() - .on_mouse_down(MouseButton::Right, { - let blame_entry = blame_entry.clone(); - let details = details.clone(); - move |event, window, cx| { - deploy_blame_entry_context_menu( - &blame_entry, - details.as_ref(), - editor.clone(), - event.position, - window, - cx, - ); - } - }) - .on_click({ - let blame_entry = blame_entry.clone(); - let repository = repository.clone(); - let workspace = workspace.clone(); - move |_, window, cx| { - CommitView::open( - CommitSummary { - sha: blame_entry.sha.to_string().into(), - subject: blame_entry.summary.clone().unwrap_or_default().into(), - commit_timestamp: blame_entry.committer_time.unwrap_or_default(), - author_name: blame_entry - .committer_name - .clone() - .unwrap_or_default() - .into(), - has_parent: true, - }, - repository.downgrade(), - workspace.clone(), - window, - cx, - ) - } - }) - .hoverable_tooltip(move |_window, cx| { - cx.new(|cx| { - CommitTooltip::blame_entry( - &blame_entry, - details.clone(), - repository.clone(), - workspace.clone(), - cx, + .child( + h_flex() + .items_center() + .gap_2() + .child(div().text_color(sha_color).child(short_commit_id)) + .child(name), ) - }) - .into() - }) + .child(relative_timestamp) + .hover(|style| style.bg(cx.theme().colors().element_hover)) + .cursor_pointer() + .on_mouse_down(MouseButton::Right, { + let blame_entry = blame_entry.clone(); + let details = details.clone(); + move |event, window, cx| { + deploy_blame_entry_context_menu( + &blame_entry, + details.as_ref(), + editor.clone(), + event.position, + window, + cx, + ); + } + }) + .on_click({ + let blame_entry = blame_entry.clone(); + let repository = repository.clone(); + let workspace = workspace.clone(); + move |_, window, cx| { + CommitView::open( + CommitSummary { + sha: blame_entry.sha.to_string().into(), + subject: blame_entry + .summary + .clone() + .unwrap_or_default() + .into(), + commit_timestamp: blame_entry + .committer_time + .unwrap_or_default(), + author_name: blame_entry + .committer_name + .clone() + .unwrap_or_default() + .into(), + has_parent: true, + }, + repository.downgrade(), + workspace.clone(), + window, + cx, + ) + } + }) + .hoverable_tooltip(move |_window, cx| { + cx.new(|cx| { + CommitTooltip::blame_entry( + &blame_entry, + details.clone(), + repository.clone(), + workspace.clone(), + cx, + ) + }) + .into() + }), + ) .into_any(), ) }