forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'worktree-agent-af983b2d7101b2441'

Browse files at this commit

701700f26c25d2cb35e5acff7486c72508297754Ahmet Kaan GümüşParent: 9bb99516ca4906
# Conflicts:
#	crates/app/src/tests/layout.rs
crates/app/src/tests/layout.rsmodified+45 -0
@@ -2694,3 +2694,48 @@ fn an_external_file_drop_is_heard_by_the_whole_room_and_imports() {
2694 "the dock answers an external file drag with nothing: {dock}"2694 "the dock answers an external file drag with nothing: {dock}"
2695 );2695 );
2696 }2696 }
2697+
2698+/// The wheel is the bench's, not a clip's: the user rolled it over the bench
2699+/// and nothing moved unless the pointer happened to sit on a track, because
2700+/// the only listeners were one per bed and one on the ruler strip. The row's
2701+/// listener now sits on the whole row (head column included) and stops there,
2702+/// and `bench-content` answers everything else -- the strip left of the ruler,
2703+/// the ruler itself, the gaps between rows, the space below the last track.
2704+/// Exactly two listeners, so no strip answers one notch twice.
2705+#[test]
2706+fn the_bench_answers_a_wheel_notch_anywhere_over_it() {
2707+ let bench = src_text("ui/bench_stance.rs");
2708+ assert_eq!(
2709+ bench.matches(".on_scroll_wheel(").count(),
2710+ 2,
2711+ "the bench has a wheel listener per region again -- a notch would be answered twice"
2712+ );
2713+ let row = bench
2714+ .find(".id((\"bench-lane\", lane.ord")
2715+ .expect("no lane row");
2716+ let bed = bench.find(".id((\"bench-bed\"").expect("no lane bed");
2717+ let row_wheel = bench[row..bed]
2718+ .find(".on_scroll_wheel(")
2719+ .map(|at| &bench[row + at..bed])
2720+ .expect("the lane row does not answer the wheel -- only its bed does");
2721+ assert!(
2722+ row_wheel[..200].contains("cx.stop_propagation();")
2723+ && row_wheel[..200].contains("this.timeline_wheel(event, cx)"),
2724+ "the row's wheel lost the mapping or its stop: {}",
2725+ &row_wheel[..200]
2726+ );
2727+ let content = bench.find(".id(\"bench-content\")").expect("no bench content");
2728+ let content_wheel = bench[content..]
2729+ .find(".on_scroll_wheel(")
2730+ .expect("the bench container does not answer the wheel");
2731+ assert!(
2732+ content_wheel < 700 && bench[content..].contains("this.timeline_wheel(event, cx)"),
2733+ "the container's wheel listener is not on the container itself"
2734+ );
2735+ let ruler = bench.find(".id(\"bench-ruler\")").expect("no ruler");
2736+ let lanes = bench.find(".id(\"bench-lanes\")").expect("no lane column");
2737+ assert!(
2738+ !bench[ruler..lanes].contains(".on_scroll_wheel("),
2739+ "the ruler answers the wheel on its own again -- one notch, two scrolls"
2740+ );
2741+}
crates/app/src/ui/bench_stance.rsmodified+20 -16
@@ -829,6 +829,17 @@ fn lane_row(
829 .h(px(h))829 .h(px(h))
830 .flex()830 .flex()
831 .relative()831 .relative()
832+ // The wheel, matched to the legacy timeline's own mapping: ctrl+wheel
833+ // zooms about the pointer, a bare wheel scrolls the bed along the film
834+ // (`Player::timeline_wheel`). On the whole row -- head column and bed
835+ // alike -- not on the bed alone: a hand rolls the wheel wherever it
836+ // left the pointer, and aiming at a clip first is a tax. Stopped here
837+ // so gpui's own overflow scroll on the lane column (`bench-lanes`) and
838+ // `bench-content`'s catch-all below never answer the same notch again.
839+ .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| {
840+ cx.stop_propagation();
841+ this.timeline_wheel(event, cx);
842+ }))
832 // Dragged, the whole track moves in the stack (`LaneDrag`,843 // Dragged, the whole track moves in the stack (`LaneDrag`,
833 // `Player::reorder_lane`) -- let go anywhere along the row, not just844 // `Player::reorder_lane`) -- let go anywhere along the row, not just
834 // over the head column, since a slot is what is being aimed at.845 // over the head column, since a slot is what is being aimed at.
@@ -1148,15 +1159,6 @@ fn lane_row(
1148 this.preview_ghost_pick(track, lane, event.event.position.x, cx);1159 this.preview_ghost_pick(track, lane, event.event.position.x, cx);
1149 }),1160 }),
1150 )1161 )
1151- // The wheel, matched to the legacy timeline's own mapping:
1152- // ctrl+wheel zooms about the pointer, a bare wheel scrolls
1153- // the bed along the film (`Player::timeline_wheel`). Stopped
1154- // here so gpui's own overflow scroll on the lane column
1155- // (`bench-lanes`) never answers the same notch a second time.
1156- .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| {
1157- cx.stop_propagation();
1158- this.timeline_wheel(event, cx);
1159- }))
1160 .children(hitmap::dynamic(1162 .children(hitmap::dynamic(
1161 move || {1163 move || {
1162 (1164 (
@@ -1290,6 +1292,15 @@ pub(crate) fn render(
1290 .flex()1292 .flex()
1291 .flex_col()1293 .flex_col()
1292 .gap(px(ROW_GAP))1294 .gap(px(ROW_GAP))
1295+ // The wheel over the WHOLE bench region, not just a bed: the ruler,
1296+ // the strip left of it, the gaps between rows and the space below the
1297+ // last track all answer a notch here with the same mapping every row
1298+ // gives (`Player::timeline_wheel`; the ruler's own former listener
1299+ // folded into this one, so no strip answers a notch twice). A row
1300+ // stops propagation, so a notch over a track never reaches this.
1301+ .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| {
1302+ this.timeline_wheel(event, cx);
1303+ }))
1293 .child(1304 .child(
1294 // Pinned ruler: click/drag to seek (reuses `Player::scrub_to`,1305 // Pinned ruler: click/drag to seek (reuses `Player::scrub_to`,
1295 // the same call the legacy ruler makes), tick marks with mono1306 // the same call the legacy ruler makes), tick marks with mono
@@ -1313,13 +1324,6 @@ pub(crate) fn render(
1313 this.scrub_to(event.position.x, true, cx);1324 this.scrub_to(event.position.x, true, cx);
1314 }),1325 }),
1315 )1326 )
1316- // Ctrl+wheel zooms about the pointer, a bare one scrolls the
1317- // bed along -- the same mapping every bed below gives, and
1318- // the legacy ruler's own (`ui/timeline.rs`'s
1319- // `on_scroll_wheel` at its ruler strip).
1320- .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| {
1321- this.timeline_wheel(event, cx);
1322- }))
1323 .children(ticks.into_iter().map(|(x, label)| {1327 .children(ticks.into_iter().map(|(x, label)| {
1324 div().absolute().top_0().left(px(x)).child(1328 div().absolute().top_0().left(px(x)).child(
1325 div()1329 div()