From cc0d02cadcdaf67362e929a28432dd734205daed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 9 Sep 2026 21:07:47 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(app):=20the=20bench=20seam?= =?UTF-8?q?=20answers=20the=20row=20a=20hand=20aims=20at?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A saved `stance-splits` held `dock=277` beside `bench=207` -- a dragged dock next to a bench press that never became a drag. Driven at 2560x1440: the seam grabbed only within ±7px of the line the eye sees, and was silent on the `BENCH` label row under it, which is the visible top edge of the timeline and so the thing the hand goes for. The drag itself was never broken -- floor 105, ceiling 1164, both correct. The band now reaches down through the bench's own section head (`BENCH_GRAB_H`, 20px: -7..+13 of the seam), and the hairline is painted by the band rather than by the 6px strip, so the whole band lights it instead of only the pixels that already had the seam. --- crates/app/src/interact.rs | 69 ++++++++++++++++++++++++---------- crates/app/src/layout.rs | 14 +++++++ crates/app/src/tests/layout.rs | 58 +++++++++++++++++++++++++++- 3 files changed, 120 insertions(+), 21 deletions(-) diff --git a/crates/app/src/interact.rs b/crates/app/src/interact.rs index 950d60d..4c1f5a4 100644 --- a/crates/app/src/interact.rs +++ b/crates/app/src/interact.rs @@ -242,8 +242,8 @@ pub(crate) fn drag_scrim(cx: &mut Context) -> Div { /// Drawn to the ghost grammar (DESIGN §11.2): nothing at rest -- a room whose /// every seam is inked is the "crowded" the user named -- then one hairline of /// dim ink under the pointer, and the same line one step brighter while the -/// hand is actually holding it. The 6 px strip is the *hit* area throughout; -/// only its 1 px edge is ever painted. `held` is the seam this window is +/// hand is actually holding it. The band below is the *hit* area throughout; +/// only one 1 px line inside it is ever painted. `held` is the seam this window is /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the /// first move -- so the lit line has to come from the model, not from `hover`. /// @@ -256,46 +256,50 @@ pub(crate) fn drag_scrim(cx: &mut Context) -> Div { /// answering in strip coordinates). A 6 px target missed by 5 px is a resize /// the hand cannot find, which is the same as no resize at all (user /// 2026-09-09: "panes should be enlargable and shrinkable" -- they already -/// were). +/// were). The hairline is painted *by the band*, not by the strip, so the +/// whole band lights it: a line raised only by the pixels that already grab +/// the seam tells a hand nothing. The bench's band is deeper still +/// ([`BENCH_GRAB_H`]) -- the row under its seam is the bench's own section +/// head, and that is where a hand aiming at "the top of the timeline" lands. /// /// A double press resets the seam to the window's own share /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere /// unusable, and the one every editor's dividers answer to. pub(crate) fn divider(split: Split, held: bool, cx: &mut Context) -> Div { let across = matches!(split, Split::Timeline | Split::Bench); + // A row seam parts the picture from a panel whose own first row is its + // section head -- empty land -- so the bench's band reaches down through + // it ([`BENCH_GRAB_H`]). Every other seam keeps [`GRAB_W`]: the dock's + // neighbour is a list whose rows start at its very edge, and the legacy + // timeline's is the edit toolbar's buttons. + let grab = match split { + Split::Bench => BENCH_GRAB_H, + _ => GRAB_W, + }; + // Named per seam: `group_hover` resolves by name through one global map, + // so two dividers sharing a name would light each other. + let group = format!("seam-{split:?}"); div() .flex_none() - .when(across, |d| { - d.h(px(SPLIT_W)).w_full().cursor_row_resize().border_t_1() - }) - .when(!across, |d| { - d.w(px(SPLIT_W)).h_full().cursor_col_resize().border_l_1() - }) - .border_color(match held { - true => gpui::Hsla::from(rgb(INK3())), - false => gpui::transparent_black(), - }) - // Lit under the pointer: the second half of "this can be dragged", said - // before the button goes down rather than after. - .when(!held, |d| { - d.hover(|s| s.border_color(rgb(STROKE_DIVIDER()))) - }) + .when(across, |d| d.h(px(SPLIT_W)).w_full()) + .when(!across, |d| d.w(px(SPLIT_W)).h_full()) .relative() .child( div() .absolute() + .group(group.clone()) .when(across, |d| { d.left_0() .right_0() .top(px(-1.)) - .h(px(GRAB_W)) + .h(px(grab)) .cursor_row_resize() }) .when(!across, |d| { d.top_0() .bottom_0() .left(px(-1.)) - .w(px(GRAB_W)) + .w(px(grab)) .cursor_col_resize() }) .on_mouse_down( @@ -315,6 +319,31 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context) -> Div cx.notify(); cx.stop_propagation(); }), + ) + // The hairline the eye is given, painted *inside* the band and + // one pixel thick, so the whole band -- not the 6 px strip it + // hangs on -- is what lights it. A line only the pixels that + // already hit the seam can raise tells the hand nothing it did + // not already know. + .child( + div() + .absolute() + .when(across, |d| { + d.left_0().right_0().top(px(1.)).h(px(1.)).border_t_1() + }) + .when(!across, |d| { + d.top_0().bottom_0().left(px(1.)).w(px(1.)).border_l_1() + }) + .border_color(match held { + true => gpui::Hsla::from(rgb(INK3())), + false => gpui::transparent_black(), + }) + // Lit under the pointer: the second half of "this can be + // dragged", said before the button goes down rather than + // after. + .when(!held, |d| { + d.group_hover(group, |s| s.border_color(rgb(STROKE_DIVIDER()))) + }), ), ) } diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 851e86c..7b93c97 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -312,6 +312,20 @@ pub(crate) const SPLIT_W: f32 = 6.; /// the strip's far side), not the six transparent pixels in front of it. pub(crate) const GRAB_W: f32 = 14.; +/// The bench seam's own band, deeper than [`GRAB_W`] because it may be: what +/// lies under the seam is `ui::stance::bench`'s own section head -- 24 px of +/// border, padding and the word "bench", with nothing in it to press -- so the +/// band reaches down through it instead of stopping 7 px past the line. Driven +/// at 2560x1440 against a real `bench=207`: with the 14 px band the seam +/// answered a press only within +/-7 px of the line the eye sees and was silent +/// on the `BENCH` label row below it, which is the visible top edge of the +/// timeline and so the thing a hand aims at ("library resizes but timeline +/// doesn't" -- a real `stance-splits` holds `dock=277`, a dragged dock, beside +/// a `bench=207` that is a press with no drag in it). 20 px hung one row above +/// the strip covers the line, the six pixels in front of it and the whole head +/// row: `-1 .. +19` of strip, `-7 .. +13` of the seam. +pub(crate) const BENCH_GRAB_H: f32 = 20.; + /// The most of the window one side column may be dragged to. A third each, so /// the picture keeps the middle at every size -- the rule [`library_w`] and /// [`inspector_w`] already lay an untouched window out by, kept once the hand diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 373915f..6ffc555 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2796,8 +2796,9 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() { "the divider's line is inked at rest: {body}" ); for step in [ - ".hover(", + ".group_hover(", "GRAB_W", + "BENCH_GRAB_H", "STROKE_DIVIDER()", "INK3()", "border_t_1()", @@ -2805,6 +2806,61 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() { ] { assert!(body.contains(step), "the divider is missing {step}"); } + // The hairline is the *band's* child, not the strip's own border: a line + // raised only by the 6 px that already grab the seam is feedback the hand + // gets after it no longer needs it (a `bench=207` -- a press with no + // drag in it -- beside a dragged `dock=277`). + assert!( + body.find(".group(group.clone())").expect("the band's group") + < body.find("border_t_1()").expect("the hairline"), + "the hairline is painted outside the band: {body}" + ); +} + +/// The band the hand actually gets, in seam coordinates -- driven at +/// 2560x1440 with a real `bench=207` before this diff: a press answered only +/// within +/-7 px of the line the eye sees, and the `BENCH` label row under it +/// -- the visible top edge of the timeline, the thing a hand aims at -- was +/// silent. The band is hung one row above the [`SPLIT_W`] strip, so its reach +/// past the line is `grab - 1 - SPLIT_W`. +#[test] +fn the_bench_seam_reaches_into_the_row_a_hand_aims_at() { + let above = 1.; + let reach = |grab: f32| grab - above - crate::layout::SPLIT_W; + // Every other seam is unchanged: its neighbour's own first row carries + // content (the dock's rows, the legacy toolbar's buttons). + assert_eq!(reach(crate::layout::GRAB_W), 7.); + // The bench's reaches through the 24 px section head far enough to cover + // the label row a hand lands on, and no further than the head itself. + let past = reach(crate::layout::BENCH_GRAB_H); + assert!( + (10. ..=crate::ui::stance::BENCH_CHROME_H).contains(&past), + "the bench band reaches {past}px past the seam" + ); +} + +/// The clamp table, driven: the seam refuses exactly two things, and neither +/// is anywhere near where a hand drags. Measured live at 2560x1440 -- +/// `bench=105` at the floor, `bench=1164` at the ceiling. +#[test] +fn the_bench_seam_stops_at_its_floor_and_its_ceiling() { + use crate::{BENCH_MIN_H, Split, split_bounds, split_size}; + use gpui::{px, size}; + + let window = size(px(2560.), px(1440.)); + let (min, max) = split_bounds(Split::Bench, 2, window, false); + assert_eq!(min, BENCH_MIN_H); + assert_eq!( + max, + 1440. - crate::ui::stance::TIME_BAND_H - crate::ui::stance::LEDGER_H - 160. + ); + for (asked, want) in [(0., min), (-942., min), (5000., max), (207., 207.)] { + assert_eq!( + split_size(Split::Bench, Some(asked), 2, window, false), + want, + "a bench dragged to {asked}" + ); + } } /// DESIGN §7: "lanes scroll behind the pinned ruler and track heads" -- pinned