From b980282891c164765d7fff65cc5e18e051ea25f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 19 Aug 2026 17:13:19 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(playback):=20a=20captions-on?= =?UTF-8?q?ly=20group=20delete=20clamps=20the=20playhead=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since a grouped caption delete ripples every member's own sub lane, a caption grouped only with other captions can shrink timeline_frames() -- and the branch that said such a delete "moves nothing that plays" skipped the one clamp mechanism there is. Grouped-ness for a caption is its link alone, so the dispatch now asks that, and the caption-only group takes the Dirty::Both path like its clip-anchored kin. Cue text itself was never stale: subtitle overlay is pull-rendered every paint. --- crates/engine/src/playback.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/playback.rs b/crates/engine/src/playback.rs index 2225128..b6b57f3 100644 --- a/crates/engine/src/playback.rs +++ b/crates/engine/src/playback.rs @@ -1880,16 +1880,24 @@ impl PlaybackSession { /// [`delete_clip`](Self::delete_clip) for the caption the pick named: a /// caption in no group lifts exactly as [`lift_sub`](Self::lift_sub) lifts /// it -- no reseek, because nothing that plays has changed -- and a caption - /// in a group takes the group with it, which ripples the media members and - /// reseeks like a delete. `false` for a bad index. + /// in a group takes the group with it, which ripples every member's own + /// lane and reseeks like a delete. `false` for a bad index. pub fn delete_sub(&mut self, lane: Lane, idx: usize) -> bool { // Which of the two, asked before anything moves: the reseek a grouped - // delete owes is the whole difference between the paths. - match self.caption_grouped_with_clips(lane, idx) { + // delete owes is the whole difference between the paths. A group of + // captions alone (no clip on another lane) still ripples every + // member's *own* sub lane closed (`Project::delete_sub_in`, since + // cdc53a6), and a sub lane counts toward `timeline_frames` exactly + // like a clip lane does -- so the timeline can shrink out from under + // the playhead from a caption-only group too, not only a media one. + // `caption_grouped_with_clips` answers a narrower question than the + // one this dispatch needs; a caption carries a link at all only once + // grouped (`place_sub` always starts one at `None`), so that alone is + // "this delete ripples more than its own lane". + match self.sub_lane(lane).get(idx).is_some_and(|s| s.link.is_some()) { true => self.edit(Dirty::Both, |p| p.delete_sub_in(lane, idx)), - // A caption in no group -- or one grouped only with other captions, - // which lift and move nothing that plays -- is the lift it always - // was. + // A caption in no group is the plain lift that touches nothing + // else: no reseek owed. false => self.project.delete_sub_in(lane, idx), } }