forge
Explore
Log in

Don't you dare go Hollow

The seam is aimed at with the hand, not the eye

Browse files at this commit

cebb935b03faa6494441e49534bd87f5bd73d670Ahmet Kaan GümüşParent: 9c4d7ce
  • style
    • the seam is aimed at with the hand, not the eye
Show full message
🎨 style(app): the seam is aimed at with the hand, not the eye

A 6 px hit strip asks for precision a hand does not have: a press one row
inside the bench focused the bench instead of grabbing the seam, which is
how a shipped resize reads as "panes should be enlargable and shrinkable".
The divider keeps its 6 px of layout and its 1 px hairline; the press and
the resize cursor move to a GRAB_W (12 px) band mounted absolutely over it,
so the reach doubles and nothing moves by a pixel at rest.
crates/app/src/interact.rsmodified+45 -17
@@ -247,6 +247,15 @@ pub(crate) fn drag_scrim(cx: &mut Context<Player>) -> Div {
247247 /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the
248248 /// first move -- so the lit line has to come from the model, not from `hover`.
249249 ///
250+/// What the *hand* aims at is wider than what the eye is given: the press and
251+/// the resize cursor live on a [`GRAB_W`] band centred on the strip, mounted
252+/// absolutely so it overlays its neighbours instead of pushing them (the strip
253+/// keeps its [`SPLIT_W`] of layout, and `layout::split_drag_size` keeps
254+/// answering in strip coordinates). A 6 px target missed by 5 px is a resize
255+/// the hand cannot find, which is the same as no resize at all (user
256+/// 2026-09-09: "panes should be enlargable and shrinkable" -- they already
257+/// were).
258+///
250259 /// A double press resets the seam to the window's own share
251260 /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere
252261 /// unusable, and the one every editor's dividers answer to.
@@ -269,23 +278,42 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div
269278 .when(!held, |d| {
270279 d.hover(|s| s.border_color(rgb(STROKE_DIVIDER())))
271280 })
272- .on_mouse_down(
273- MouseButton::Left,
274- cx.listener(move |this, event: &MouseDownEvent, _, cx| {
275- match event.click_count >= 2 {
276- // The reset is written where a release would have written
277- // the drag, the same small round trip: a seam put back by
278- // hand must not come back on the next launch.
279- true => {
280- this.split_drag = None;
281- this.splits.clear(split);
282- crate::layout::save_stance_splits(&this.splits);
283- }
284- false => this.split_drag = Some(split),
285- }
286- cx.notify();
287- cx.stop_propagation();
288- }),
281+ .relative()
282+ .child(
283+ div()
284+ .absolute()
285+ .when(across, |d| {
286+ d.left_0()
287+ .right_0()
288+ .top(px((SPLIT_W - GRAB_W) / 2.))
289+ .h(px(GRAB_W))
290+ .cursor_row_resize()
291+ })
292+ .when(!across, |d| {
293+ d.top_0()
294+ .bottom_0()
295+ .left(px((SPLIT_W - GRAB_W) / 2.))
296+ .w(px(GRAB_W))
297+ .cursor_col_resize()
298+ })
299+ .on_mouse_down(
300+ MouseButton::Left,
301+ cx.listener(move |this, event: &MouseDownEvent, _, cx| {
302+ match event.click_count >= 2 {
303+ // The reset is written where a release would have written
304+ // the drag, the same small round trip: a seam put back by
305+ // hand must not come back on the next launch.
306+ true => {
307+ this.split_drag = None;
308+ this.splits.clear(split);
309+ crate::layout::save_stance_splits(&this.splits);
310+ }
311+ false => this.split_drag = Some(split),
312+ }
313+ cx.notify();
314+ cx.stop_propagation();
315+ }),
316+ ),
289317 )
290318 }
291319
crates/app/src/layout.rsmodified+10 -0
@@ -288,6 +288,16 @@ impl Split {
288288 /// it looks like.
289289 pub(crate) const SPLIT_W: f32 = 6.;
290290
291+/// How wide the same seam is *aimed at*. The strip above is what the layout
292+/// spends and the hairline is what the eye is given; this is the band the hand
293+/// gets, centred on the strip and overlaid on the two panels it parts, so
294+/// growing it moves nothing. 6 px asked the hand for precision it does not
295+/// have -- the lead's own press one row into the bench missed the seam by 5 px
296+/// and focused the bench instead ("panes should be enlargable and shrinkable",
297+/// of panes that already resized). 12 px is the ±6 px of aim every editor's
298+/// dividers allow.
299+pub(crate) const GRAB_W: f32 = 12.;
300+
291301 /// The most of the window one side column may be dragged to. A third each, so
292302 /// the picture keeps the middle at every size -- the rule [`library_w`] and
293303 /// [`inspector_w`] already lay an untouched window out by, kept once the hand
crates/app/src/tests/layout.rsmodified+11 -2
@@ -2724,7 +2724,9 @@ fn the_bench_answers_a_wheel_notch_anywhere_over_it() {
27242724 "the row's wheel lost the mapping or its stop: {}",
27252725 &row_wheel[..200]
27262726 );
2727- let content = bench.find(".id(\"bench-content\")").expect("no bench content");
2727+ let content = bench
2728+ .find(".id(\"bench-content\")")
2729+ .expect("no bench content");
27282730 let content_wheel = bench[content..]
27292731 .find(".on_scroll_wheel(")
27302732 .expect("the bench container does not answer the wheel");
@@ -2791,7 +2793,14 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() {
27912793 body.contains("gpui::transparent_black()"),
27922794 "the divider's line is inked at rest: {body}"
27932795 );
2794- for step in [".hover(", "STROKE_DIVIDER()", "INK3()", "border_t_1()", "border_l_1()"] {
2796+ for step in [
2797+ ".hover(",
2798+ "GRAB_W",
2799+ "STROKE_DIVIDER()",
2800+ "INK3()",
2801+ "border_t_1()",
2802+ "border_l_1()",
2803+ ] {
27952804 assert!(body.contains(step), "the divider is missing {step}");
27962805 }
27972806 }