Project · focus that follows: segments, the tracker's action, tests

A segmented control too narrow for its segments now scrolls sideways
in a strip of its own, and a segment that takes focus comes into view:
its focus is a tab_stop handle, and layout::reveal_when_focused, now
shared with the board's cards, measures it from a box that holds its
ring. The DatabaseView's own strip goes.

The time tracker's Start and Stop are one Button that keeps one handle
through the new Button::focus_handle. A start moves focus to it, a stop
hands focus back to the field, and the field starts on Enter's release,
so the release no longer clicks the Stop that took focus.

ProgressRing's percent refuses content inside, as content refuses a
percent. Tests: Enter starts, Enter stops after 90 seconds, and the
field takes the keys again; Skip moves on at once; a focused Timeline
segment at 280px comes into view; the ring's refusal.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-27 06:32:50 -04:00
1 parent f70726476a
commit 384872cbf0
13 files changed
+294 -132

No files matched your search

+18
View File
@@ -197,6 +197,11 @@ impl ProgressRing {
/// Shows the value as a percent inside the ring.
pub fn percent(mut self) -> Self {
assert!(
self.inside.is_none(),
"progress ring {:?}: a percent or content inside, not both",
self.id
);
self.percent = true;
self
}
@@ -278,3 +283,16 @@ impl RenderOnce for ProgressRing {
.children(self.inside)
}
}
#[cfg(test)]
mod tests {
use gpui::div;
use super::ProgressRing;
#[test]
#[should_panic(expected = "a percent or content inside, not both")]
fn a_ring_holds_a_percent_or_content_not_both() {
let _ = ProgressRing::new("ring", 0.5).inside(div()).percent();
}
}