From db9815b98c4c20cf4ff675529d6983751eb9b66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 21 Aug 2026 01:05:18 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ui):=20a=20lane=20row=20grow?= =?UTF-8?q?s=20to=20fit=20its=20own=20dot,=20not=20just=20its=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LANE_MIN_H was 18px, the label's own line box (gpui defaults line_height to the golden ratio, not 1x font size, so 11px mono renders in an 18px box) but not the status dot beneath it. Every lane's dot silently spilled into the row below -- invisible except on the last lane, which has no next row to spill into and clipped into the ledger instead. LANE_MIN_H is now derived from the label's line box + head gap + dot diameter (24px), so BENCH_MIN_H rises from 82 to 94, and a new test recomputes that content height independently so a future shrink or label-size growth fails loudly instead of clipping quietly again. --- crates/app/src/layout.rs | 10 ++++++--- crates/app/src/tests/layout.rs | 29 +++++++++++++++++++++++++ crates/app/src/ui/bench_stance.rs | 35 ++++++++++++++++++++++++++++--- 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 11339bd..6123ecd 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -445,9 +445,13 @@ pub(crate) const TIMELINE_MAX_SHARE: f32 = 0.7; /// gap). Below this the `bench-lanes` column asks for more height than /// `bench-content`'s flex_1 gives it, and since that column scrolls rather /// than clips visibly, the shortfall comes off the bottom row's own pixels -/// unscrolled -- A1's clip-bar border and status dot, first. At the old -/// literal `80.` the shortfall was `82. - 80. == 2.`, the exact ~2px clip -/// this floor now closes. +/// unscrolled -- A1's clip-bar border and status dot, first. `LANE_MIN_H` +/// itself is now derived from what a lane head actually draws (its own +/// doc comment), not a number copied from nowhere: an earlier floor of +/// `82.` used a `LANE_MIN_H` of `18.` that fit only the lane label and let +/// every lane's status dot overflow into the row beneath it, invisible +/// everywhere but the last lane, which has no next row to spill into and +/// clipped straight into the ledger instead. pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H + crate::ui::bench_stance::RULER_H + crate::ui::bench_stance::ROW_GAP diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 2902fc0..4df7022 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1817,6 +1817,35 @@ fn both_default_lanes_fit_the_bench_at_its_floor() { ); } +/// The previous test asserted lane ROWS fit the bench column -- not that a +/// lane's own CONTENT fits its row, which is how the defect it fixed +/// survived it: at the old `LANE_MIN_H` of `18.` both lanes fit the bench +/// exactly while V1's status dot silently overflowed into A1's row (masked) +/// and A1's overflowed into the ledger (visible, since A1 has no next row). +/// This binary carries no `TestAppContext` to mount a real `lane_row` and +/// read its painted bounds back, so this recomputes the label's own line +/// box from the constants `lane_row` actually draws with (gpui's default +/// `TextStyle::line_height` is the golden ratio, not 1x the font size -- +/// see `LANE_MIN_H`'s own doc comment) rather than a literal, so a future +/// shrink of `LANE_MIN_H` or growth of the label size fails this instead of +/// silently clipping the last lane again. +#[test] +fn a_lane_row_fits_what_its_own_head_draws() { + use crate::ui::bench_stance::{LANE_DOT_D, LANE_HEAD_GAP, LANE_MIN_H}; + use crate::ui::type_scale::CHORD_METADATA_MIN_PX; + + let label_line_h = (CHORD_METADATA_MIN_PX * 1.618_034).round(); + let content = label_line_h + LANE_HEAD_GAP + LANE_DOT_D; + assert!( + LANE_MIN_H >= content, + "LANE_MIN_H ({LANE_MIN_H}) is shorter than what a lane head actually \ + draws ({content}px: {label_line_h}px label line box + \ + {LANE_HEAD_GAP}px gap + {LANE_DOT_D}px dot) -- the status dot \ + would spill past the row, invisible until it is the last lane \ + with no next row to spill into" + ); +} + /// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) /// keeps it off the bench, at *any* bench height -- not merely the floor -- /// because its bottom offset always lands at or above the bench's own top diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index c9ab7ac..fa951f1 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -67,7 +67,29 @@ pub(crate) const ROW_GAP: f32 = 2.; /// scrolls behind the pinned ruler and heads instead of compressing further. const LANES_COMPRESS: usize = 5; const LANE_FULL_H: f32 = 40.; -pub(crate) const LANE_MIN_H: f32 = 18.; +/// The gap `lane_row`'s pinned head column puts between the lane label and +/// its status dot (its own `.gap(px(...))`), named so [`LANE_MIN_H`]'s +/// derivation below doesn't repeat the literal blind. +pub(crate) const LANE_HEAD_GAP: f32 = 2.; +/// The status dot's own diameter (`lane_row`'s "Pinned track head" child, +/// its own `.w(px(...)).h(px(...))`). +pub(crate) const LANE_DOT_D: f32 = 4.; +/// The lane label's own line box at [`type_scale::CHORD_METADATA_MIN_PX`]: +/// gpui's default `TextStyle::line_height` is not 1x the font size but the +/// golden ratio (`gpui::phi()` == `relative(1.618034)`), and `lane_row` +/// never calls `.line_height()` on the head label to override it -- so this +/// is what the label really occupies, not its glyph height. +/// round(12. * 1.618034) would be wrong here: the head uses +/// `CHORD_METADATA_MIN_PX` (11.), so round(11. * 1.618034) = round(17.798) +/// = 18. +const LANE_LABEL_LINE_H: f32 = 18.; +/// The least a lane row may be: what its own head actually draws, not a +/// number copied from nowhere. The old `18.` fit only the label's line box +/// and let every lane's status dot overflow into the row beneath it -- +/// invisible everywhere but the last lane, which has no next row to spill +/// into and clipped straight into the ledger instead (adversarial pass on +/// the `BENCH_MIN_H = 82` floor). +pub(crate) const LANE_MIN_H: f32 = LANE_LABEL_LINE_H + LANE_HEAD_GAP + LANE_DOT_D; /// One clip's degradation tier (DESIGN ยง7), picked off the clip's own worth /// in pixels (`span`, unclamped) rather than its drawn floor @@ -596,7 +618,7 @@ fn lane_row( .flex_col() .items_center() .justify_center() - .gap(px(2.)) + .gap(px(LANE_HEAD_GAP)) .bg(rgb(DARK_PANEL())) .cursor(CursorStyle::OpenHand) .on_drag(LaneDrag(lane), move |_, _, _, cx| { @@ -609,7 +631,14 @@ fn lane_row( )) .text_color(rgb(INK2())) .child(lane.label()) - .child(div().flex_none().w(px(4.)).h(px(4.)).rounded(px(2.)).bg(rgb(dot))), + .child( + div() + .flex_none() + .w(px(LANE_DOT_D)) + .h(px(LANE_DOT_D)) + .rounded(px(LANE_DOT_D / 2.)) + .bg(rgb(dot)), + ), ) .child( // The bed: a drop target for the Sources tab (`AssetDrag`,