Git · rows: trailing words give way before actions, which keep their room; row actions tested by key

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 03:17:05 -04:00
1 parent e01b82bcbd
commit 922cd53a8c
2 files changed
+28 -5

No files matched your search

+13 -1
View File
@@ -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:?}"
);
}
+15 -4
View File
@@ -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.))