Subtitle row's second line reads the timeline, not a constant
Browse files at this commita7683f58216ddf632b585b25f50d61f25259859fParent: 8a81f1f- fix
- subtitle row's second line reads the timeline, not a constant
1 changed file +19 -0
crates/app/src/ui/dock_stance.rsmodified+19 -0
| @@ -630,6 +630,24 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | ||
| 630 | 630 | Some(session) => subtitle_rows(session.subtitles()), |
| 631 | 631 | None => Vec::new(), |
| 632 | 632 | }; |
| 633 | + // Which lane(s) actually hold each track's captions right now -- the | |
| 634 | + // row's second line answers "is it showing?", so it has to read the | |
| 635 | + // timeline, not stay the literal "not placed" it was born saying (the | |
| 636 | + // old palette's badge never updated after a drop). | |
| 637 | + let placed_on = |track: usize| -> Option<String> { | |
| 638 | + let session = player.session.as_ref()?; | |
| 639 | + let lanes: Vec<String> = session | |
| 640 | + .lanes() | |
| 641 | + .into_iter() | |
| 642 | + .filter(|lane| session.sub_lane(*lane).iter().any(|sub| sub.track == track)) | |
| 643 | + .map(|lane| lane.label()) | |
| 644 | + .collect(); | |
| 645 | + if lanes.is_empty() { | |
| 646 | + None | |
| 647 | + } else { | |
| 648 | + Some(lanes.join(" ")) | |
| 649 | + } | |
| 650 | + }; | |
| 633 | 651 | let count: usize = groups.iter().map(|group| group.rows.len()).sum(); |
| 634 | 652 | let rows: Vec<_> = groups |
| 635 | 653 | .into_iter() |
| @@ -653,6 +671,7 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | ||
| 653 | 671 | .into(); |
| 654 | 672 | let detail: SharedString = row |
| 655 | 673 | .refused |
| 674 | + .or_else(|| placed_on(track)) | |
| 656 | 675 | .unwrap_or_else(|| "not placed".to_string()) |
| 657 | 676 | .into(); |
| 658 | 677 | let ghost = title.clone(); |