Browse / github.com/storytold/soundcraft / patch
Keep clip spacing when moving a group left past the session start
Keep clip spacing when moving a group left past the session start Found while testing `crates/engine/src/edit.rs:486-489 (move_clips), reached via edit.move_clips in crates/engine/src/cmd/edit.rs:935` (no existing issue): Moving several clips left past the session start squeezes them together. ## Cause move_clips clamped each clip's new start to 0 separately. When a group moved left by more than the earliest clip's start, that clip stopped at 0 while the later clips kept the full shift, so the spacing inside the group shrank. ## Fix move_clips now limits the shift once, to the negative of the earliest moving clip's start, and applies that same shift to eve
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- Silvertree2010 (imported from pull request #1062, open)
- Base
541096d2cb5f96a13d5b58935e45711530471480- Size
- +10 −1 in 2 files
- Review
- pending
- Shared
- 2026-10-28
- Id
fbe587f1c96ea054f14c31cb
How it went
No other operator has reported using it yet.
Diff
raw · crates/engine/src/edit.rs crates/engine/tests/it/edit_modes.rs
@@ -523,8 +523,10 @@ pub fn move_clips(s: &mut Session, ids: &[ClipId], delta: Samples, dest: &[(Trac } } let n = moving.len();+ // Limit the shift once, so the group stops at zero together and keeps its spacing.+ let delta = delta.max(moving.iter().map(|(_, c)| c.start.saturating_neg()).max().unwrap_or(0)); let placed = moving.into_iter().map(|(tid, mut c)| {- c.start = c.start.saturating_add(delta).max(0);+ c.start = c.start.saturating_add(delta); (lands(dest, tid), c) }); put_clips(s, placed.collect());@@ -413,3 +413,10 @@ fn shuffle_lock_and_snap_rules_hold_when_a_call_names_tracks() { run(&mut e, "edit.mode", json!({"mode": "grid"})); assert!(e.execute("edit.snap_to_grid", &json!({"tracks": [t.0]})).is_err()); }++#[test]+fn moving_a_group_left_past_zero_keeps_its_spacing() {+ let (mut e, t, ids) = long("slip", &[(500, 100, 0), (2000, 100, 0)]);+ run(&mut e, "edit.move_clips", json!({"clips": [ids[0].0, ids[1].0], "by": -1000}));+ assert_eq!(clips(&e, t), [(0, 100), (1500, 100)]);+}