From 7fab0725fb801ee1364c46b4b0f31b902f569d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Wed, 7 Oct 2026 04:15:44 -0400 Subject: [PATCH] =?UTF-8?q?Git=20=C2=B7=20ref=20rows:=20detail=20on=20its?= =?UTF-8?q?=20own=20line,=20name=20gives=20way,=20actions=20take=20the=20t?= =?UTF-8?q?railing=20words'=20place=20on=20hover?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/git/refs.rs | 60 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/src/git/refs.rs b/src/git/refs.rs index 0c98d46..ef1b008 100644 --- a/src/git/refs.rs +++ b/src/git/refs.rs @@ -232,6 +232,7 @@ pub(super) fn listed( .when(pick.selected, |row| row.bg(colors.selection)) .on_click(move |_, window, cx| run(window, cx)) }) + .relative() .flex() .items_center() .gap_2() @@ -240,33 +241,54 @@ pub(super) fn listed( .rounded(theme.radius(Radius::Sm)) .hover(|row| row.bg(colors.hover)) .child(Icon::new(icon).size(IconSize::Sm).color(colors.fg_muted)) - .child(div().flex_none().child(name)) .child( div() .flex_1() .min_w_0() - .text_color(colors.fg_subtle) - .child(Ellipsis::new(detail)), + .flex() + .flex_col() + .child( + div() + .flex() + .items_center() + .gap_2() + // Narrow, the name gives way; the words stay. + .child( + div() + .flex_1() + .min_w_0() + .overflow_hidden() + .whitespace_nowrap() + .child(name), + ) + .child( + div() + .flex_none() + .flex() + .gap_2() + .group_hover(group.clone(), |words| words.opacity(0.)) + .children(trailing.into_iter().map(|words| { + tabular(div().text_color(colors.fg_subtle)).child(words) + })), + ), + ) + .when(!detail.is_empty(), |text| { + text.child( + div() + .text_color(colors.fg_subtle) + .child(Ellipsis::new(detail)), + ) + }), ) - // Narrow, the trailing words give way before the actions. + // On hover the actions take the words' place. .child( div() - .flex_shrink(1.0) - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .flex() - .gap_2() - .children( - trailing - .into_iter() - .map(|words| tabular(div().text_color(colors.fg_subtle)).child(words)), - ), - ) - .child( - div() - .flex_none() + .absolute() + .top_0() + .bottom_0() + .right_1() .flex() + .items_center() .opacity(0.) .group_hover(group, |actions| actions.opacity(1.)) .children(actions),