forge
Explore
Log in

Don't you dare go Hollow

The bench seam answers the row a hand aims at

Browse files at this commit

cc0d02cadcdaf67362e929a28432dd734205daedAhmet Kaan GümüşParent: 388faa6
  • fix
    • the bench seam answers the row a hand aims at
Show full message
🐛 fix(app): the bench seam answers the row a hand aims at

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.rsmodified+49 -20
@@ -242,8 +242,8 @@ pub(crate) fn drag_scrim(cx: &mut Context<Player>) -> Div {
242 /// Drawn to the ghost grammar (DESIGN §11.2): nothing at rest -- a room whose242 /// Drawn to the ghost grammar (DESIGN §11.2): nothing at rest -- a room whose
243 /// every seam is inked is the "crowded" the user named -- then one hairline of243 /// every seam is inked is the "crowded" the user named -- then one hairline of
244 /// dim ink under the pointer, and the same line one step brighter while the244 /// dim ink under the pointer, and the same line one step brighter while the
245-/// hand is actually holding it. The 6 px strip is the *hit* area throughout;245+/// hand is actually holding it. The band below is the *hit* area throughout;
246-/// only its 1 px edge is ever painted. `held` is the seam this window is246+/// only one 1 px line inside it is ever painted. `held` is the seam this window is
247 /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the247 /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the
248 /// first move -- so the lit line has to come from the model, not from `hover`.248 /// first move -- so the lit line has to come from the model, not from `hover`.
249 ///249 ///
@@ -256,46 +256,50 @@ pub(crate) fn drag_scrim(cx: &mut Context<Player>) -> Div {
256 /// answering in strip coordinates). A 6 px target missed by 5 px is a resize256 /// answering in strip coordinates). A 6 px target missed by 5 px is a resize
257 /// the hand cannot find, which is the same as no resize at all (user257 /// the hand cannot find, which is the same as no resize at all (user
258 /// 2026-09-09: "panes should be enlargable and shrinkable" -- they already258 /// 2026-09-09: "panes should be enlargable and shrinkable" -- they already
259-/// were).259+/// were). The hairline is painted *by the band*, not by the strip, so the
260+/// whole band lights it: a line raised only by the pixels that already grab
261+/// the seam tells a hand nothing. The bench's band is deeper still
262+/// ([`BENCH_GRAB_H`]) -- the row under its seam is the bench's own section
263+/// head, and that is where a hand aiming at "the top of the timeline" lands.
260 ///264 ///
261 /// A double press resets the seam to the window's own share265 /// A double press resets the seam to the window's own share
262 /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere266 /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere
263 /// unusable, and the one every editor's dividers answer to.267 /// unusable, and the one every editor's dividers answer to.
264 pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div {268 pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div {
265 let across = matches!(split, Split::Timeline | Split::Bench);269 let across = matches!(split, Split::Timeline | Split::Bench);
270+ // A row seam parts the picture from a panel whose own first row is its
271+ // section head -- empty land -- so the bench's band reaches down through
272+ // it ([`BENCH_GRAB_H`]). Every other seam keeps [`GRAB_W`]: the dock's
273+ // neighbour is a list whose rows start at its very edge, and the legacy
274+ // timeline's is the edit toolbar's buttons.
275+ let grab = match split {
276+ Split::Bench => BENCH_GRAB_H,
277+ _ => GRAB_W,
278+ };
279+ // Named per seam: `group_hover` resolves by name through one global map,
280+ // so two dividers sharing a name would light each other.
281+ let group = format!("seam-{split:?}");
266 div()282 div()
267 .flex_none()283 .flex_none()
268- .when(across, |d| {284+ .when(across, |d| d.h(px(SPLIT_W)).w_full())
269- d.h(px(SPLIT_W)).w_full().cursor_row_resize().border_t_1()285+ .when(!across, |d| d.w(px(SPLIT_W)).h_full())
270- })
271- .when(!across, |d| {
272- d.w(px(SPLIT_W)).h_full().cursor_col_resize().border_l_1()
273- })
274- .border_color(match held {
275- true => gpui::Hsla::from(rgb(INK3())),
276- false => gpui::transparent_black(),
277- })
278- // Lit under the pointer: the second half of "this can be dragged", said
279- // before the button goes down rather than after.
280- .when(!held, |d| {
281- d.hover(|s| s.border_color(rgb(STROKE_DIVIDER())))
282- })
283 .relative()286 .relative()
284 .child(287 .child(
285 div()288 div()
286 .absolute()289 .absolute()
290+ .group(group.clone())
287 .when(across, |d| {291 .when(across, |d| {
288 d.left_0()292 d.left_0()
289 .right_0()293 .right_0()
290 .top(px(-1.))294 .top(px(-1.))
291- .h(px(GRAB_W))295+ .h(px(grab))
292 .cursor_row_resize()296 .cursor_row_resize()
293 })297 })
294 .when(!across, |d| {298 .when(!across, |d| {
295 d.top_0()299 d.top_0()
296 .bottom_0()300 .bottom_0()
297 .left(px(-1.))301 .left(px(-1.))
298- .w(px(GRAB_W))302+ .w(px(grab))
299 .cursor_col_resize()303 .cursor_col_resize()
300 })304 })
301 .on_mouse_down(305 .on_mouse_down(
@@ -315,6 +319,31 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div
315 cx.notify();319 cx.notify();
316 cx.stop_propagation();320 cx.stop_propagation();
317 }),321 }),
322+ )
323+ // The hairline the eye is given, painted *inside* the band and
324+ // one pixel thick, so the whole band -- not the 6 px strip it
325+ // hangs on -- is what lights it. A line only the pixels that
326+ // already hit the seam can raise tells the hand nothing it did
327+ // not already know.
328+ .child(
329+ div()
330+ .absolute()
331+ .when(across, |d| {
332+ d.left_0().right_0().top(px(1.)).h(px(1.)).border_t_1()
333+ })
334+ .when(!across, |d| {
335+ d.top_0().bottom_0().left(px(1.)).w(px(1.)).border_l_1()
336+ })
337+ .border_color(match held {
338+ true => gpui::Hsla::from(rgb(INK3())),
339+ false => gpui::transparent_black(),
340+ })
341+ // Lit under the pointer: the second half of "this can be
342+ // dragged", said before the button goes down rather than
343+ // after.
344+ .when(!held, |d| {
345+ d.group_hover(group, |s| s.border_color(rgb(STROKE_DIVIDER())))
346+ }),
318 ),347 ),
319 )348 )
320 }349 }
crates/app/src/layout.rsmodified+14 -0
@@ -312,6 +312,20 @@ pub(crate) const SPLIT_W: f32 = 6.;
312 /// the strip's far side), not the six transparent pixels in front of it.312 /// the strip's far side), not the six transparent pixels in front of it.
313 pub(crate) const GRAB_W: f32 = 14.;313 pub(crate) const GRAB_W: f32 = 14.;
314 314
315+/// The bench seam's own band, deeper than [`GRAB_W`] because it may be: what
316+/// lies under the seam is `ui::stance::bench`'s own section head -- 24 px of
317+/// border, padding and the word "bench", with nothing in it to press -- so the
318+/// band reaches down through it instead of stopping 7 px past the line. Driven
319+/// at 2560x1440 against a real `bench=207`: with the 14 px band the seam
320+/// answered a press only within +/-7 px of the line the eye sees and was silent
321+/// on the `BENCH` label row below it, which is the visible top edge of the
322+/// timeline and so the thing a hand aims at ("library resizes but timeline
323+/// doesn't" -- a real `stance-splits` holds `dock=277`, a dragged dock, beside
324+/// a `bench=207` that is a press with no drag in it). 20 px hung one row above
325+/// the strip covers the line, the six pixels in front of it and the whole head
326+/// row: `-1 .. +19` of strip, `-7 .. +13` of the seam.
327+pub(crate) const BENCH_GRAB_H: f32 = 20.;
328+
315 /// The most of the window one side column may be dragged to. A third each, so329 /// The most of the window one side column may be dragged to. A third each, so
316 /// the picture keeps the middle at every size -- the rule [`library_w`] and330 /// the picture keeps the middle at every size -- the rule [`library_w`] and
317 /// [`inspector_w`] already lay an untouched window out by, kept once the hand331 /// [`inspector_w`] already lay an untouched window out by, kept once the hand
crates/app/src/tests/layout.rsmodified+57 -1
@@ -2796,8 +2796,9 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() {
2796 "the divider's line is inked at rest: {body}"2796 "the divider's line is inked at rest: {body}"
2797 );2797 );
2798 for step in [2798 for step in [
2799- ".hover(",2799+ ".group_hover(",
2800 "GRAB_W",2800 "GRAB_W",
2801+ "BENCH_GRAB_H",
2801 "STROKE_DIVIDER()",2802 "STROKE_DIVIDER()",
2802 "INK3()",2803 "INK3()",
2803 "border_t_1()",2804 "border_t_1()",
@@ -2805,6 +2806,61 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() {
2805 ] {2806 ] {
2806 assert!(body.contains(step), "the divider is missing {step}");2807 assert!(body.contains(step), "the divider is missing {step}");
2807 }2808 }
2809+ // The hairline is the *band's* child, not the strip's own border: a line
2810+ // raised only by the 6 px that already grab the seam is feedback the hand
2811+ // gets after it no longer needs it (a `bench=207` -- a press with no
2812+ // drag in it -- beside a dragged `dock=277`).
2813+ assert!(
2814+ body.find(".group(group.clone())").expect("the band's group")
2815+ < body.find("border_t_1()").expect("the hairline"),
2816+ "the hairline is painted outside the band: {body}"
2817+ );
2818+}
2819+
2820+/// The band the hand actually gets, in seam coordinates -- driven at
2821+/// 2560x1440 with a real `bench=207` before this diff: a press answered only
2822+/// within +/-7 px of the line the eye sees, and the `BENCH` label row under it
2823+/// -- the visible top edge of the timeline, the thing a hand aims at -- was
2824+/// silent. The band is hung one row above the [`SPLIT_W`] strip, so its reach
2825+/// past the line is `grab - 1 - SPLIT_W`.
2826+#[test]
2827+fn the_bench_seam_reaches_into_the_row_a_hand_aims_at() {
2828+ let above = 1.;
2829+ let reach = |grab: f32| grab - above - crate::layout::SPLIT_W;
2830+ // Every other seam is unchanged: its neighbour's own first row carries
2831+ // content (the dock's rows, the legacy toolbar's buttons).
2832+ assert_eq!(reach(crate::layout::GRAB_W), 7.);
2833+ // The bench's reaches through the 24 px section head far enough to cover
2834+ // the label row a hand lands on, and no further than the head itself.
2835+ let past = reach(crate::layout::BENCH_GRAB_H);
2836+ assert!(
2837+ (10. ..=crate::ui::stance::BENCH_CHROME_H).contains(&past),
2838+ "the bench band reaches {past}px past the seam"
2839+ );
2840+}
2841+
2842+/// The clamp table, driven: the seam refuses exactly two things, and neither
2843+/// is anywhere near where a hand drags. Measured live at 2560x1440 --
2844+/// `bench=105` at the floor, `bench=1164` at the ceiling.
2845+#[test]
2846+fn the_bench_seam_stops_at_its_floor_and_its_ceiling() {
2847+ use crate::{BENCH_MIN_H, Split, split_bounds, split_size};
2848+ use gpui::{px, size};
2849+
2850+ let window = size(px(2560.), px(1440.));
2851+ let (min, max) = split_bounds(Split::Bench, 2, window, false);
2852+ assert_eq!(min, BENCH_MIN_H);
2853+ assert_eq!(
2854+ max,
2855+ 1440. - crate::ui::stance::TIME_BAND_H - crate::ui::stance::LEDGER_H - 160.
2856+ );
2857+ for (asked, want) in [(0., min), (-942., min), (5000., max), (207., 207.)] {
2858+ assert_eq!(
2859+ split_size(Split::Bench, Some(asked), 2, window, false),
2860+ want,
2861+ "a bench dragged to {asked}"
2862+ );
2863+ }
2808 }2864 }
2809 2865
2810 /// DESIGN §7: "lanes scroll behind the pinned ruler and track heads" -- pinned2866 /// DESIGN §7: "lanes scroll behind the pinned ruler and track heads" -- pinned