A captions-only group delete clamps the playhead too
Browse files at this commitb980282891c164765d7fff65cc5e18e051ea25f4Parent: 3e1c94d- fix
- a captions-only group delete clamps the playhead too
1 changed file +15 -7
crates/engine/src/playback.rsmodified+15 -7
| @@ -1880,16 +1880,24 @@ impl PlaybackSession { | ||
| 1880 | 1880 | /// [`delete_clip`](Self::delete_clip) for the caption the pick named: a |
| 1881 | 1881 | /// caption in no group lifts exactly as [`lift_sub`](Self::lift_sub) lifts |
| 1882 | 1882 | /// 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 and | |
| 1884 | - /// reseeks like a delete. `false` for a bad index. | |
| 1883 | + /// in a group takes the group with it, which ripples every member's own | |
| 1884 | + /// lane and reseeks like a delete. `false` for a bad index. | |
| 1885 | 1885 | pub fn delete_sub(&mut self, lane: Lane, idx: usize) -> bool { |
| 1886 | 1886 | // Which of the two, asked before anything moves: the reseek a grouped |
| 1887 | - // delete owes is the whole difference between the paths. | |
| 1888 | - match self.caption_grouped_with_clips(lane, idx) { | |
| 1887 | + // delete owes is the whole difference between the paths. A group of | |
| 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 | 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, | |
| 1891 | - // which lift and move nothing that plays -- is the lift it always | |
| 1892 | - // was. | |
| 1899 | + // A caption in no group is the plain lift that touches nothing | |
| 1900 | + // else: no reseek owed. | |
| 1893 | 1901 | false => self.project.delete_sub_in(lane, idx), |
| 1894 | 1902 | } |
| 1895 | 1903 | } |