Merge branch 'worktree-agent-aab77017ca1647130'
Browse files at this commit3 changed files +53 -2
- crates/app/src/interact.rs +30 -0
- crates/app/src/layout.rs +12 -0
- crates/app/src/tests/layout.rs +11 -2
crates/app/src/interact.rsmodified+30 -0
| @@ -247,6 +247,17 @@ pub(crate) fn drag_scrim(cx: &mut Context<Player>) -> Div { | |||
| 247 | /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the | 247 | /// 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 | /// |
| 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 *line the eye | ||
| 252 | +/// sees* -- one row above the strip, so it reaches past the panel edge the | ||
| 253 | +/// strip stands in front of rather than being centred on the strip -- mounted | ||
| 254 | +/// absolutely so it overlays its neighbours instead of pushing them (the strip | ||
| 255 | +/// keeps its [`SPLIT_W`] of layout, and `layout::split_drag_size` keeps | ||
| 256 | +/// 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 (user | ||
| 258 | +/// 2026-09-09: "panes should be enlargable and shrinkable" -- they already | ||
| 259 | +/// were). | ||
| 260 | +/// | ||
| 250 | /// A double press resets the seam to the window's own share | 261 | /// A double press resets the seam to the window's own share |
| 251 | /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere | 262 | /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere |
| 252 | /// unusable, and the one every editor's dividers answer to. | 263 | /// unusable, and the one every editor's dividers answer to. |
| @@ -269,6 +280,24 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div | |||
| 269 | .when(!held, |d| { | 280 | .when(!held, |d| { |
| 270 | d.hover(|s| s.border_color(rgb(STROKE_DIVIDER()))) | 281 | d.hover(|s| s.border_color(rgb(STROKE_DIVIDER()))) |
| 271 | }) | 282 | }) |
| 283 | + .relative() | ||
| 284 | + .child( | ||
| 285 | + div() | ||
| 286 | + .absolute() | ||
| 287 | + .when(across, |d| { | ||
| 288 | + d.left_0() | ||
| 289 | + .right_0() | ||
| 290 | + .top(px(-1.)) | ||
| 291 | + .h(px(GRAB_W)) | ||
| 292 | + .cursor_row_resize() | ||
| 293 | + }) | ||
| 294 | + .when(!across, |d| { | ||
| 295 | + d.top_0() | ||
| 296 | + .bottom_0() | ||
| 297 | + .left(px(-1.)) | ||
| 298 | + .w(px(GRAB_W)) | ||
| 299 | + .cursor_col_resize() | ||
| 300 | + }) | ||
| 272 | .on_mouse_down( | 301 | .on_mouse_down( |
| 273 | MouseButton::Left, | 302 | MouseButton::Left, |
| 274 | cx.listener(move |this, event: &MouseDownEvent, _, cx| { | 303 | cx.listener(move |this, event: &MouseDownEvent, _, cx| { |
| @@ -286,6 +315,7 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div | |||
| 286 | cx.notify(); | 315 | cx.notify(); |
| 287 | cx.stop_propagation(); | 316 | cx.stop_propagation(); |
| 288 | }), | 317 | }), |
| 318 | + ), | ||
| 289 | ) | 319 | ) |
| 290 | } | 320 | } |
| 291 | 321 | ||
crates/app/src/layout.rsmodified+12 -0
| @@ -288,6 +288,18 @@ impl Split { | |||
| 288 | /// it looks like. | 288 | /// it looks like. |
| 289 | pub(crate) const SPLIT_W: f32 = 6.; | 289 | pub(crate) const SPLIT_W: f32 = 6.; |
| 290 | 290 | ||
| 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, and it is hung one row above the strip rather than centred | ||
| 299 | +/// on it: what a hand aims at is the line it can see (the panel's own edge at | ||
| 300 | +/// the strip's far side), not the six transparent pixels in front of it. | ||
| 301 | +pub(crate) const GRAB_W: f32 = 14.; | ||
| 302 | + | ||
| 291 | /// The most of the window one side column may be dragged to. A third each, so | 303 | /// The most of the window one side column may be dragged to. A third each, so |
| 292 | /// the picture keeps the middle at every size -- the rule [`library_w`] and | 304 | /// the picture keeps the middle at every size -- the rule [`library_w`] and |
| 293 | /// [`inspector_w`] already lay an untouched window out by, kept once the hand | 305 | /// [`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() { | |||
| 2724 | "the row's wheel lost the mapping or its stop: {}", | 2724 | "the row's wheel lost the mapping or its stop: {}", |
| 2725 | &row_wheel[..200] | 2725 | &row_wheel[..200] |
| 2726 | ); | 2726 | ); |
| 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"); | ||
| 2728 | let content_wheel = bench[content..] | 2730 | let content_wheel = bench[content..] |
| 2729 | .find(".on_scroll_wheel(") | 2731 | .find(".on_scroll_wheel(") |
| 2730 | .expect("the bench container does not answer the wheel"); | 2732 | .expect("the bench container does not answer the wheel"); |
| @@ -2791,7 +2793,14 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() { | |||
| 2791 | body.contains("gpui::transparent_black()"), | 2793 | body.contains("gpui::transparent_black()"), |
| 2792 | "the divider's line is inked at rest: {body}" | 2794 | "the divider's line is inked at rest: {body}" |
| 2793 | ); | 2795 | ); |
| 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 | + ] { | ||
| 2795 | assert!(body.contains(step), "the divider is missing {step}"); | 2804 | assert!(body.contains(step), "the divider is missing {step}"); |
| 2796 | } | 2805 | } |
| 2797 | } | 2806 | } |