forge
Explore
Log in

Don't you dare go Hollow

A captions-only group delete clamps the playhead too

Browse files at this commit

b980282891c164765d7fff65cc5e18e051ea25f4Ahmet Kaan GümüşParent: 3e1c94d
  • fix
    • a captions-only group delete clamps the playhead too
Show full message
🐛 fix(playback): a captions-only group delete clamps the playhead too

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.rsmodified+15 -7
@@ -1880,16 +1880,24 @@ impl PlaybackSession {
1880 /// [`delete_clip`](Self::delete_clip) for the caption the pick named: a1880 /// [`delete_clip`](Self::delete_clip) for the caption the pick named: a
1881 /// caption in no group lifts exactly as [`lift_sub`](Self::lift_sub) lifts1881 /// caption in no group lifts exactly as [`lift_sub`](Self::lift_sub) lifts
1882 /// it -- no reseek, because nothing that plays has changed -- and a caption1882 /// it -- no reseek, because nothing that plays has changed -- and a caption
1883- /// in a group takes the group with it, which ripples the media members and1883+ /// in a group takes the group with it, which ripples every member's own
1884- /// reseeks like a delete. `false` for a bad index.1884+ /// lane and reseeks like a delete. `false` for a bad index.
1885 pub fn delete_sub(&mut self, lane: Lane, idx: usize) -> bool {1885 pub fn delete_sub(&mut self, lane: Lane, idx: usize) -> bool {
1886 // Which of the two, asked before anything moves: the reseek a grouped1886 // Which of the two, asked before anything moves: the reseek a grouped
1887- // delete owes is the whole difference between the paths.1887+ // delete owes is the whole difference between the paths. A group of
1888- match self.caption_grouped_with_clips(lane, idx) {1888+ // captions alone (no clip on another lane) still ripples every
1889+ // member's *own* sub lane closed (`Project::delete_sub_in`, since
1890+ // cdc53a6), and a sub lane counts toward `timeline_frames` exactly
1891+ // like a clip lane does -- so the timeline can shrink out from under
1892+ // the playhead from a caption-only group too, not only a media one.
1893+ // `caption_grouped_with_clips` answers a narrower question than the
1894+ // one this dispatch needs; a caption carries a link at all only once
1895+ // grouped (`place_sub` always starts one at `None`), so that alone is
1896+ // "this delete ripples more than its own lane".
1897+ match self.sub_lane(lane).get(idx).is_some_and(|s| s.link.is_some()) {
1889 true => self.edit(Dirty::Both, |p| p.delete_sub_in(lane, idx)),1898 true => self.edit(Dirty::Both, |p| p.delete_sub_in(lane, idx)),
1890- // A caption in no group -- or one grouped only with other captions,1899+ // A caption in no group is the plain lift that touches nothing
1891- // which lift and move nothing that plays -- is the lift it always1900+ // else: no reseek owed.
1892- // was.
1893 false => self.project.delete_sub_in(lane, idx),1901 false => self.project.delete_sub_in(lane, idx),
1894 }1902 }
1895 }1903 }