From 922cd53a8cf0cd96be7a5df09d882def14960537 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 03:17:05 -0400 Subject: [PATCH] =?UTF-8?q?Git=20=C2=B7=20rows:=20trailing=20words=20give?= =?UTF-8?q?=20way=20before=20actions,=20which=20keep=20their=20room;=20row?= =?UTF-8?q?=20actions=20tested=20by=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/git/picking.rs | 14 +++++++++++++- src/git/refs.rs | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/git/picking.rs b/src/git/picking.rs index c89b754..ddd71fd 100644 --- a/src/git/picking.rs +++ b/src/git/picking.rs @@ -70,12 +70,19 @@ impl Render for Lists { commit: "a1".into(), when: "today".into(), }; - let tagged = self.heard.clone(); + let (tagged, switched, deleted) = + (self.heard.clone(), self.heard.clone(), self.heard.clone()); frame .child( BranchList::new("branches", [branch("main", true), branch("side", false)]) .on_pick(move |name, _, _| { pick.borrow_mut().picked.push(name.to_string()) + }) + .on_switch(move |name, _, _| { + switched.borrow_mut().picked.push(format!("switch {name}")) + }) + .on_delete(move |name, _, _| { + deleted.borrow_mut().picked.push(format!("delete {name}")) }), ) .child(TagList::new("tags", [tag]).on_pick(move |name, _, _| { @@ -206,4 +213,9 @@ fn branches_and_tags_pick_from_the_keyboard(cx: &mut TestAppContext) { picked.contains(&"side".to_string()) && picked.contains(&"v1".to_string()), "{picked:?}" ); + let acted = |what: &str| picked.iter().any(|said| said == what); + assert!( + acted("switch side") && acted("delete side"), + "row actions answer: {picked:?}" + ); } diff --git a/src/git/refs.rs b/src/git/refs.rs index 94c38dc..5187b46 100644 --- a/src/git/refs.rs +++ b/src/git/refs.rs @@ -248,13 +248,24 @@ pub(super) fn listed( .text_color(colors.fg_subtle) .child(Ellipsis::new(detail)), ) - .children( - trailing - .into_iter() - .map(|words| tabular(div().flex_none().text_color(colors.fg_subtle)).child(words)), + // Narrow, the trailing words give way before the actions. + .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() .flex() .opacity(0.) .group_hover(group, |actions| actions.opacity(1.))