Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Arc<Sequence>: fix the missed &mut sites and closing braces; drop the unrelated key-dispatch test

Brandon Thomas68c297b9876c
diff --git a/crates/engine/src/clip_ops.rs b/crates/engine/src/clip_ops.rs
index f9c0e0775..1ef93e95c 100644
--- a/crates/engine/src/clip_ops.rs
+++ b/crates/engine/src/clip_ops.rs
@@ -1769,4 +1769,4 @@ fn short_clips(s: &Session, clips: &[u64]) -> Vec<Value> {
(frames > 0).then(|| json!({"clip": c, "shortByFrames": frames}))
})
.collect()
- }
+}
diff --git a/crates/engine/src/source_monitor.rs b/crates/engine/src/source_monitor.rs
index 836fff49e..cdbcf35f7 100644
--- a/crates/engine/src/source_monitor.rs
+++ b/crates/engine/src/source_monitor.rs
@@ -94,7 +94,7 @@ fn marker_list(p: &mut Project, item: ItemId) -> Result<&mut Vec<Marker>> {
let it = p.item_mut(item).ok_or_else(|| EngineError::Other("Source item is unavailable".into()))?;
match &mut it.kind {
filmcraft_project::ItemKind::Media(m) => Ok(&mut m.markers),
- filmcraft_project::ItemKind::Sequence(q) => Ok(&mut q.markers),
+ filmcraft_project::ItemKind::Sequence(q) => Ok(&mut std::sync::Arc::make_mut(q).markers),
_ => Err(EngineError::Other("Source marker editing requires media or a sequence".into())),
}
}
diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs
index 1abdc6668..e1b628be2 100644
--- a/crates/format/src/lib.rs
+++ b/crates/format/src/lib.rs
@@ -224,6 +224,7 @@ fn validate_loaded(mut loaded: Loaded) -> Result<Loaded, FormatError> {
m.info.audio_streams.truncate(max);
}
filmcraft_project::ItemKind::Sequence(sequence) => {
+ let sequence = std::sync::Arc::make_mut(sequence);
for clip in sequence.audio_tracks.iter_mut().flat_map(|t| t.items.iter_mut()) {
if clip.audio_stream >= max {
log::warn!("sequence `{name}`: clip `{}` uses audio stream {}, reset to 0", clip.name, clip.audio_stream);
diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs
index 6261889d5..d5e508b6d 100644
--- a/crates/project/src/lib.rs
+++ b/crates/project/src/lib.rs
@@ -1996,4 +1996,4 @@ mod tests {
nest.frame_hold = Some(f(100));
assert_eq!(p.nest_overhang(&nest), Some(nest.range()));
}
- }
+}
diff --git a/crates/ui-egui/tests/scripted.rs b/crates/ui-egui/tests/scripted.rs
index 700010e50..63903a485 100644
--- a/crates/ui-egui/tests/scripted.rs
+++ b/crates/ui-egui/tests/scripted.rs
@@ -506,29 +506,6 @@ fn keyboard_shortcuts_dialog_assigns_live_and_cancel_restores() {
assert_eq!(track_clips(&d.sequence(), 0).len(), n0 + 1);
}
-#[test]
-fn shortcuts_in_one_input_frame_are_all_dispatched() {
- let mut d = Driver::demo();
- d.exec("playhead.set", json!({"seconds": 2.0}));
- d.ok("ui.set", json!({"focused": "Timeline"}));
- let before = d.sequence();
- let n0 = track_clips(&before, 0).len();
- let ph = before["playhead"].as_i64().unwrap();
-
- // Raw OS-style events, deliberately in the same egui input frame. These bypass the control
- // channel's synthetic pointer sequencing and exercise normal shortcut dispatch directly.
- let command = egui::Modifiers { command: true, ..Default::default() };
- let key = |key, modifiers| egui::Event::Key { key, physical_key: Some(key), pressed: true, repeat: false, modifiers };
- let events = &mut d.harness.input_mut().events;
- events.push(key(egui::Key::K, command));
- events.push(key(egui::Key::ArrowRight, egui::Modifiers::default()));
- d.frames(1);
-
- let after = d.sequence();
- assert_eq!(track_clips(&after, 0).len(), n0 + 1, "Cmd+K was lost when another key arrived in the same input frame");
- assert!(after["playhead"].as_i64().unwrap() > ph, "Right was lost when another key arrived in the same input frame");
-}
-
/// Waveform peaks are cached per item id; ids repeat across projects, so opening another project
/// must not reuse the previous project's peaks (it showed a long mission-audio clip as silent).
#[test]