forge
Explore
Log in

Don't you dare go Hollow

A subtitle row says which film it came out of, and the film is named over its tracks

Browse files at this commit

ad9f1ba0d4598af41650a84512169a2323ee3586Ahmet Kaan GümüşParent: d5d7fdf
  • feat
    • a subtitle row says which film it came out of, and the film is named over its tracks
Show full message
✨ feat(subtitles): a subtitle row says which film it came out of, and the film is named over its tracks

The list was flat and anonymous: eight rows off three files, every one of
them "eng" or "und", with the only answer to "whose is this?" hidden in a
tooltip. Now a row names its own file in front of the label -- but only
where there is more than one file to tell apart, the way an audio row
takes "[audio 2]" only where the file gave several -- and wears that
file's tint down its left edge, the same colour its clips wear on the
lanes and its rows wear in the media list above.

The name is cut out of its middle rather than its end. Two episodes off
one release are the same words up to the last two characters, and a name
truncated from the right is the same row printed twice; `clip_middle`
keeps both ends and spends the width it is given, so a wider window
spells more of the file out and nothing is capped at a character count
somebody guessed. The media list's own names go through it too -- that
list had the same collision and nobody had noticed.

Where the window is tall enough for it, each file's block is headed by
its name and its tint: a label, no click, nothing to fold, so the tracks
under it stay the only things to aim at. At the 640x360 floor the list is
one row tall, and a header there would name a film and then show none of
it -- so `sub_headers_fit` turns them off and the rows go on saying whose
they are by themselves. Nothing about the pick moved: a click still sets
the flat index into the add-order list, which is what the .edith holds.
crates/app/src/main.rsmodified+364 -61
@@ -198,6 +198,26 @@ const SUB_CUE_MIN_W: f32 = 2.;
198198 /// How much of the subtitle list in the library column is on screen at once,
199199 /// past which it scrolls -- the media list above it is what keeps the height.
200200 const SUB_ROWS_H: f32 = 3. * ROW_H;
201+/// The row naming the file a block of tracks came out of. Shorter than a track
202+/// row because nothing on it is clicked -- `HIT_MIN` binds targets and a header
203+/// is a label, not a way in -- and drawn at all only where the column has the
204+/// height to show tracks under it ([`sub_headers_fit`]).
205+const SUB_HEAD_H: f32 = 18.;
206+/// How much of the subtitle list is on screen at the 640x360 floor: one row,
207+/// measured -- the section's own heading and the Add button under it take the
208+/// rest of the 84 px the column has there.
209+const SUB_ROWS_AT_FLOOR: f32 = ROW_H;
210+/// How much of a subtitle row's width the file's name in front of the label may
211+/// take. Half: which file and which language are both worth reading, and a name
212+/// given the whole row is a row where the language is what gets truncated.
213+const SUB_STEM_SHARE: f32 = 0.5;
214+/// Roughly how wide one character of an 11 px list row is. Generous on purpose:
215+/// the element truncates for real, and a budget that overshoots would have the
216+/// element cut the tail off after [`clip_middle`] had already kept it.
217+const LIST_CHAR_W: f32 = 6.;
218+/// The fewest characters a clipped name is cut to, however narrow the column
219+/// gets: past this there is nothing on either side of the gap to read.
220+const LIST_CLIP_MIN: usize = 5;
201221
202222 /// The one key name this file still spells out, and gpui's spelling of it: it
203223 /// is the way out of a capture and out of the overlay, and both have to work
@@ -4894,7 +4914,11 @@ impl Render for Player {
48944914 .flex_1()
48954915 .min_h(px(0.))
48964916 .flex()
4897- .child(self.library(library_w(f32::from(window.viewport_size().width)), cx))
4917+ .child(self.library(
4918+ library_w(f32::from(window.viewport_size().width)),
4919+ f32::from(window.viewport_size().height),
4920+ cx,
4921+ ))
48984922 .child(
48994923 div()
49004924 .flex_1()
@@ -4970,7 +4994,7 @@ impl Player {
49704994 /// the rest of this window: nothing in it takes focus, so the root keeps
49714995 /// the keyboard and the play key still works after a row is clicked
49724996 /// (ledger:182).
4973- fn library(&self, width: f32, cx: &mut Context<Self>) -> impl IntoElement {
4997+ fn library(&self, width: f32, viewport_h: f32, cx: &mut Context<Self>) -> impl IntoElement {
49744998 let exporting = self.exporting().is_some();
49754999 let sources = self
49765000 .session
@@ -5142,7 +5166,15 @@ impl Player {
51425166 // Two lines rather than two columns: at the width
51435167 // this panel yields to, a name and a timecode side
51445168 // by side leave room for neither.
5145- .child(div().truncate().text_size(px(11.)).child(name))
5169+ // Cut out of the middle, not the end: two episodes off
5170+ // one release are the same words up to the number, and
5171+ // the number is at the end.
5172+ .child(
5173+ div()
5174+ .truncate()
5175+ .text_size(px(11.))
5176+ .child(clip_middle(&name, row_text_w(width))),
5177+ )
51465178 .child(
51475179 div()
51485180 .truncate()
@@ -5210,7 +5242,7 @@ impl Player {
52105242 // Under the media it belongs to: a subtitle track is not a source --
52115243 // it goes on no lane and is dragged nowhere -- but it is a thing the
52125244 // timeline holds, and this is the list of those.
5213- .children(self.subtitle_section(cx))
5245+ .children(self.subtitle_section(width, viewport_h, cx))
52145246 .child(control(
52155247 "add-asset",
52165248 None,
@@ -5244,65 +5276,188 @@ impl Player {
52445276 /// as a media row the timeline cannot take is: PGS subtitles are pictures,
52455277 /// and a film carrying four of them says so instead of listing nothing.
52465278 ///
5279+ /// Every row names the file it came out of itself, in words and in the tint
5280+ /// that file's clips wear on the lanes -- but only where there is more than
5281+ /// one file to tell apart, the way [`row_name`] numbers audio streams only
5282+ /// where a file gave several. Where the window is tall enough for it
5283+ /// ([`sub_headers_fit`]) each file's block is headed by its name as well: a
5284+ /// label and nothing more, no click and nothing to fold, so the rows under
5285+ /// it are the only things anybody has to aim at. At the 640x360 floor the
5286+ /// headers are gone and the rows still say whose they are.
5287+ ///
52475288 /// `None` when there are none -- an empty heading is a section about
52485289 /// nothing.
5249- fn subtitle_section(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
5290+ fn subtitle_section(
5291+ &self,
5292+ width: f32,
5293+ viewport_h: f32,
5294+ cx: &mut Context<Self>,
5295+ ) -> Option<impl IntoElement> {
52505296 let tracks = self.session.as_ref()?.subtitles();
52515297 if tracks.is_empty() {
52525298 return None;
52535299 }
5254- let rows: Vec<_> = tracks
5255- .iter()
5256- .enumerate()
5257- .map(|(i, track)| {
5258- let picked = i == self.sub_track;
5259- let usable = track.refused.is_none();
5260- let under = subtitle_detail(track);
5261- let tip: SharedString = match &track.refused {
5262- Some(why) => format!("{} — {why}", track.path.display()),
5263- None => format!(
5264- "{} — click to show this track over the picture",
5265- track.path.display()
5266- ),
5267- }
5268- .into();
5300+ let groups = subtitle_rows(tracks);
5301+ // One file's tracks need no prefix saying which file: it is the only
5302+ // one, and every row would carry the same word.
5303+ let several_files = groups.len() > 1;
5304+ let headed = several_files && sub_headers_fit(viewport_h);
5305+ let text_w = row_text_w(width);
5306+ let rows: Vec<_> = groups
5307+ .into_iter()
5308+ .map(|SubGroup { name, path, rows }| {
5309+ // The file's own colour, the one its media rows and its clips
5310+ // wear -- and none at all for a standalone `.srt`, which came
5311+ // off no file on this timeline.
5312+ let tint = file_tint(self.sources(), &path);
5313+ let numbered = rows.len() > 1;
5314+ // The name twice over: all of it the header can hold, and the
5315+ // share of a row a prefix may take in front of the label.
5316+ let head = clip_middle(&name, text_w);
5317+ let prefix = clip_middle(&name, text_w * SUB_STEM_SHARE);
5318+ let rows: Vec<_> = rows
5319+ .into_iter()
5320+ .map(|row| {
5321+ let track = row.track;
5322+ let picked = track == self.sub_track;
5323+ let usable = row.refused.is_none();
5324+ // Two tracks off one remux that both say "eng" are told
5325+ // apart by their number and by nothing else -- the same
5326+ // count [`sub_pick_name`] echoes.
5327+ let title = match numbered {
5328+ true => format!("{} {}", row.label, row.number),
5329+ false => row.label,
5330+ };
5331+ // The whole path, never clipped: the row says which
5332+ // file, and the tooltip says which one on disk.
5333+ let tip: SharedString = match &row.refused {
5334+ Some(why) => format!("{} — {why}", path.display()),
5335+ None => format!(
5336+ "{} — click to show this track over the picture",
5337+ path.display()
5338+ ),
5339+ }
5340+ .into();
5341+ div()
5342+ // The *flat* index into the session's add-order
5343+ // list, which is what a pick is and what a save
5344+ // writes: the grouping moved the row on screen and
5345+ // never the track it stands for.
5346+ .id(("subtitle-track", track))
5347+ .flex_none()
5348+ .h(px(ROW_H))
5349+ .flex()
5350+ .items_center()
5351+ .gap(px(6.))
5352+ .pr(px(6.))
5353+ .rounded(px(3.))
5354+ .when(!usable, |d| d.text_color(rgb(INK_DIM)).opacity(0.55))
5355+ .when(usable, |d| {
5356+ d.cursor_pointer()
5357+ .hover(|s| s.bg(rgb(HOVER)))
5358+ .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
5359+ this.sub_track = track;
5360+ // Picking a track is asking to see it: a
5361+ // click that changed nothing on screen
5362+ // because the toggle was off would read
5363+ // as a dead row.
5364+ this.subs_on = true;
5365+ cx.notify();
5366+ }))
5367+ })
5368+ .when(picked, |d| d.bg(rgb(SELECTED)))
5369+ .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
5370+ // The media rows' bar, same width and hard against
5371+ // the same edge: one association across the panel
5372+ // and the lanes. Kept as room rather than dropped
5373+ // where there is no tint, so a standalone `.srt`
5374+ // still lines its words up with the rest.
5375+ .child(
5376+ div()
5377+ .flex_none()
5378+ .w(px(SWATCH_W))
5379+ .h_full()
5380+ .rounded(px(2.))
5381+ .when_some(tint, |d, tint| d.bg(rgb(tint))),
5382+ )
5383+ .child(
5384+ div()
5385+ .flex_1()
5386+ .min_w(px(0.))
5387+ .flex()
5388+ .flex_col()
5389+ .child(
5390+ div()
5391+ .flex()
5392+ .text_size(px(11.))
5393+ // In front, because the column
5394+ // truncates from the right: an
5395+ // ownership word at the end is a
5396+ // word the floor never shows.
5397+ .when(several_files, |d| {
5398+ d.child(
5399+ div()
5400+ .flex_none()
5401+ // Said twice where a
5402+ // header says it above:
5403+ // still there, out of
5404+ // the way.
5405+ .when(headed, |d| {
5406+ d.text_color(rgb(INK_DIM))
5407+ })
5408+ .child(format!("{prefix} · ")),
5409+ )
5410+ })
5411+ .child(
5412+ div()
5413+ .flex_1()
5414+ .min_w(px(0.))
5415+ .truncate()
5416+ .child(title),
5417+ ),
5418+ )
5419+ .child(
5420+ div()
5421+ .truncate()
5422+ .text_size(px(10.))
5423+ .text_color(rgb(INK_DIM))
5424+ .child(row.detail),
5425+ ),
5426+ )
5427+ })
5428+ .collect();
52695429 div()
5270- .id(("subtitle-track", i))
52715430 .flex_none()
5272- .h(px(ROW_H))
52735431 .flex()
52745432 .flex_col()
5275- .justify_center()
5276- .px(px(6.))
5277- .rounded(px(3.))
5278- .when(!usable, |d| d.text_color(rgb(INK_DIM)).opacity(0.55))
5279- .when(usable, |d| {
5280- d.cursor_pointer()
5281- .hover(|s| s.bg(rgb(HOVER)))
5282- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
5283- this.sub_track = i;
5284- // Picking a track is asking to see it: a click
5285- // that changed nothing on screen because the
5286- // toggle was off would read as a dead row.
5287- this.subs_on = true;
5288- cx.notify();
5289- }))
5433+ .gap(px(2.))
5434+ // The header: which film these came out of, in words and not
5435+ // in colour alone. No id, no click, nothing to fold -- a
5436+ // label, which is why it is allowed under `HIT_MIN`.
5437+ .when(headed, |d| {
5438+ d.child(
5439+ div()
5440+ .flex_none()
5441+ .h(px(SUB_HEAD_H))
5442+ .flex()
5443+ .items_center()
5444+ .gap(px(6.))
5445+ .text_size(px(10.))
5446+ .text_color(rgb(INK_DIM))
5447+ .when_some(tint, |d, tint| {
5448+ d.child(
5449+ div()
5450+ .flex_none()
5451+ .w(px(SWATCH_W))
5452+ .h_full()
5453+ .rounded(px(2.))
5454+ .bg(rgb(tint)),
5455+ )
5456+ })
5457+ .child(div().flex_1().min_w(px(0.)).truncate().child(head)),
5458+ )
52905459 })
5291- .when(picked, |d| d.bg(rgb(SELECTED)))
5292- .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
5293- .child(
5294- div()
5295- .truncate()
5296- .text_size(px(11.))
5297- .child(track.label.clone()),
5298- )
5299- .child(
5300- div()
5301- .truncate()
5302- .text_size(px(10.))
5303- .text_color(rgb(INK_DIM))
5304- .child(under),
5305- )
5460+ .children(rows)
53065461 })
53075462 .collect();
53085463 Some(
@@ -9373,12 +9528,10 @@ fn subtitle_detail(track: &engine::subtitle::SubtitleTrack) -> String {
93739528 /// before anything is drawn -- the grouping is the branchy part and it is the
93749529 /// same answer whatever a styling puts around it.
93759530 ///
9376-/// ponytail: only [`sub_pick_name`] reads these -- [`Player::subtitle_section`]
9377-/// still *lists* the flat rows, so the grouping shows in what the headers say
9378-/// and not yet in how the list is laid out. The upgrade is that section
9379-/// rendering groups instead.
9531+/// [`Player::subtitle_section`] draws one block per group of these, and
9532+/// [`sub_pick_name`] names the pick out of the same answer -- so what a heading
9533+/// says and what a row a person clicked says cannot disagree.
93809534 #[derive(Debug, PartialEq)]
9381-#[allow(dead_code)]
93829535 struct SubGroup {
93839536 /// What the group is called: the file without its extension, which is what
93849537 /// a person named the film even when the subtitles came out of a remux.
@@ -9392,7 +9545,6 @@ struct SubGroup {
93929545
93939546 /// One subtitle track, as a row shows it.
93949547 #[derive(Debug, PartialEq)]
9395-#[allow(dead_code)]
93969548 struct SubRow {
93979549 /// Which track of the session's list this row is: the *flat* index into the
93989550 /// add-order Vec `PlaybackSession::subtitles` hands back, which is what a
@@ -9418,7 +9570,6 @@ struct SubRow {
94189570 /// distinct path, in the order the files first appear, and each file's tracks
94199571 /// in the order they were added. Two remuxes' tracks arriving interleaved --
94209572 /// which is what importing a second film does -- still read as two films.
9421-#[allow(dead_code)]
94229573 fn subtitle_rows(tracks: &[engine::subtitle::SubtitleTrack]) -> Vec<SubGroup> {
94239574 let mut groups: Vec<SubGroup> = Vec::new();
94249575 for (track, sub) in tracks.iter().enumerate() {
@@ -10033,6 +10184,55 @@ fn library_w(window_w: f32) -> f32 {
1003310184 .min(window_w / 3.)
1003410185 }
1003510186
10187+/// What is left of a library column this wide for a row's *words*: the panel's
10188+/// padding on both sides, the tint bar, the gap after it and the row's own right
10189+/// inset. Every row in the column -- media and subtitle -- is built to this
10190+/// shape, so one number answers for both.
10191+fn row_text_w(width: f32) -> f32 {
10192+ // 8 px of panel padding each side, then the bar, the gap after it and the
10193+ // row's own right inset -- the numbers the rows are built with.
10194+ width - 16. - SWATCH_W - 6. - 6.
10195+}
10196+
10197+/// A name cut to what a column this wide can hold, out of the *middle*. Two
10198+/// files off one release differ in their last characters and nowhere else --
10199+/// "…Episode 01" against "…02" -- so a name cut from the right is the same
10200+/// name twice and the list stops naming anything. The width decides how much
10201+/// survives, not a number of characters somebody guessed: a wider window spells
10202+/// more of the file out, and the floor still keeps both ends.
10203+///
10204+/// The element truncates for real; this only decides where what is lost comes
10205+/// out of.
10206+fn clip_middle(name: &str, width: f32) -> String {
10207+ let budget = ((width / LIST_CHAR_W) as usize).max(LIST_CLIP_MIN);
10208+ let chars: Vec<char> = name.chars().collect();
10209+ if chars.len() <= budget {
10210+ return name.to_string();
10211+ }
10212+ // The gap costs a character, and what is left of the odd one goes to the
10213+ // tail: the tail is the half that tells two of them apart.
10214+ let head = (budget - 1) / 2;
10215+ let tail = budget - 1 - head;
10216+ format!(
10217+ "{}…{}",
10218+ chars[..head].iter().collect::<String>(),
10219+ chars[chars.len() - tail..].iter().collect::<String>()
10220+ )
10221+}
10222+
10223+/// Whether the subtitle list has the height to name each file over its tracks.
10224+/// A header is worth its own height only where there are still tracks under it
10225+/// to read: at the 640x360 floor the list is one row tall, and a header there
10226+/// would name a film and show none of it -- so at the floor there are no
10227+/// headers and the rows say which file they came from themselves.
10228+///
10229+/// The window's height answers it on its own: the row above the picture and the
10230+/// panel under it are fixed, so every pixel the window gains past the floor is a
10231+/// pixel this column gains.
10232+fn sub_headers_fit(viewport_h: f32) -> bool {
10233+ SUB_ROWS_AT_FLOOR + (viewport_h - 360.).max(0.) >= SUB_HEAD_H + 2. * ROW_H
10234+}
10235+
1003610236 /// What the window is called: the program, and what is open in it. The name is
1003710237 /// what the header shows, so an empty window says the program alone rather than
1003810238 /// "no file open — edith".
@@ -12087,8 +12287,10 @@ mod tests {
1208712287 visible_slice,
1208812288 };
1208912289 use super::{
12090- SUB_BOTTOM, SUB_CUE_MIN_W, SUB_INK, SUB_LANE_H, SUB_LINE_H, SUB_ROWS_H, SUB_TEXT, cue_box,
12091- cues_at, file_tint, is_matroska, is_subtitle, lang_human, subtitle_detail, subtitle_notice,
12290+ SUB_BOTTOM, SUB_CUE_MIN_W, SUB_HEAD_H, SUB_INK, SUB_LANE_H, SUB_LINE_H, SUB_ROWS_H,
12291+ SUB_STEM_SHARE, SUB_TEXT, clip_middle, cue_box,
12292+ cues_at, file_tint, is_matroska, is_subtitle, lang_human, row_text_w, sub_headers_fit,
12293+ subtitle_detail, subtitle_notice,
1209212294 sub_pick_name, subtitle_rows, subtitle_strip_h,
1209312295 };
1209412296
@@ -15610,6 +15812,61 @@ mod tests {
1561015812 // taking the media list's room.
1561115813 assert_eq!(SUB_ROWS_H / ROW_H, 3.);
1561215814 assert!(ROW_H >= HIT_MIN, "a subtitle row is clicked to pick it");
15815+ // At the floor there are no group headers at all: the list is one row
15816+ // tall there, and a header would name a film and then show none of it.
15817+ // The rows go on naming their own file, so nothing is lost by it.
15818+ assert!(!sub_headers_fit(360.), "a header at the floor eats the track");
15819+ // At the size the window opens on there is room for a header and the
15820+ // tracks under it, which is the only condition it is drawn on.
15821+ assert!(sub_headers_fit(720.));
15822+ // ...and where it is drawn it fits inside the same capped list, header
15823+ // and two rows under it, without the tracks losing their budget.
15824+ assert!(SUB_HEAD_H + 2. * ROW_H <= SUB_ROWS_H);
15825+ // A header takes no click -- there is nothing to fold and nothing to
15826+ // aim at -- which is the only reason it may be under `HIT_MIN`.
15827+ assert!(SUB_HEAD_H < HIT_MIN && SUB_HEAD_H > 0.);
15828+ }
15829+
15830+ /// What the rows of both lists do with a name too long for the column: two
15831+ /// episodes off one release differ in their last two characters, and a name
15832+ /// cut from the right is the same row twice.
15833+ #[test]
15834+ fn a_long_name_is_cut_out_of_its_middle_so_two_episodes_stay_two_rows() {
15835+ let (a, b) = (
15836+ "A Long Release Name Of A Series 01",
15837+ "A Long Release Name Of A Series 02",
15838+ );
15839+ // The two call sites at the narrowest the column ever is: a media row's
15840+ // name gets the row's whole width, a subtitle row's file prefix gets a
15841+ // share of it because the language has to fit beside it.
15842+ let media = row_text_w(LIBRARY_MIN_W);
15843+ let prefix = media * SUB_STEM_SHARE;
15844+ for width in [media, prefix] {
15845+ assert!(width > 0., "the floor leaves a row no words at all");
15846+ assert_ne!(
15847+ clip_middle(a, width),
15848+ clip_middle(b, width),
15849+ "{width}px: two episodes read as one row"
15850+ );
15851+ // Both ends survive: the release's name at the front, the number
15852+ // that tells them apart at the back.
15853+ assert!(clip_middle(a, width).starts_with('F'));
15854+ assert!(clip_middle(a, width).ends_with("01"));
15855+ assert!(clip_middle(a, width).contains('…'));
15856+ // Never wider than the column can hold, gap included.
15857+ assert!(clip_middle(a, width).chars().count() <= (width / 6.) as usize + 1);
15858+ }
15859+ // A name the width holds is left exactly as it is -- no gap, nothing
15860+ // dropped -- and so is a name at any width once the column is wide.
15861+ assert_eq!(clip_middle("eng.srt", 400.), "eng.srt");
15862+ assert_eq!(clip_middle(a, 4000.), a);
15863+ // Nothing panics at a width no column ever has, and something of both
15864+ // ends is still there.
15865+ assert_eq!(clip_middle(a, 0.).chars().count(), 5);
15866+ assert!(clip_middle(a, 0.).ends_with('1'));
15867+ // Counted in characters and not bytes: a name in another script is cut
15868+ // between its letters, not through one.
15869+ assert_eq!(clip_middle("ααααααααααααααα", 24.), "αα…αα");
1561315870 }
1561415871
1561515872 /// The two doors subtitles arrive through, end to end on the fixtures: a
@@ -16302,6 +16559,52 @@ mod tests {
1630216559 assert_eq!(groups[0].rows[1].track, 2);
1630316560 }
1630416561
16562+ /// The same claim from the click's end, on the order imports actually
16563+ /// arrive in: two films opened one after the other and an `.srt` dropped
16564+ /// last interleave in the flat list, and the display reorders them. What a
16565+ /// click sets is the row's own `track`, so the *n*th row on screen has to
16566+ /// pick the track it shows and the echoes have to name that same file.
16567+ #[test]
16568+ fn a_click_on_a_regrouped_row_picks_the_track_that_row_shows() {
16569+ let tracks = [
16570+ sub("/films/a.mkv", Some(1), "eng"),
16571+ sub("/films/b.mkv", Some(1), "eng"),
16572+ sub("/films/a.mkv", Some(2), "fre"),
16573+ sub("/subs/late.srt", None, "late.srt"),
16574+ sub("/films/b.mkv", Some(3), "ger"),
16575+ ];
16576+ let rows: Vec<_> = subtitle_rows(&tracks)
16577+ .into_iter()
16578+ .flat_map(|group| {
16579+ group
16580+ .rows
16581+ .into_iter()
16582+ .map(move |row| (group.path.clone(), row))
16583+ })
16584+ .collect();
16585+ // Read top to bottom, the rows are no longer in add order...
16586+ assert_eq!(
16587+ rows.iter().map(|(_, row)| row.track).collect::<Vec<_>>(),
16588+ [0, 2, 1, 4, 3]
16589+ );
16590+ for (path, row) in &rows {
16591+ // ...and what the click writes into `sub_track` -- and a save into
16592+ // the `.edith` -- still lands on the track the row is showing.
16593+ let picked = &tracks[row.track];
16594+ assert_eq!(&picked.path, path, "row {} picks another file", row.track);
16595+ assert_eq!(lang_human(&picked.label), row.label);
16596+ // And the heading, the strip and the notice name that same file
16597+ // back, so a click cannot leave the echoes pointing elsewhere.
16598+ let echo = sub_pick_name(&tracks, row.track).expect("the row's own track");
16599+ let stem = path.file_stem().expect("a fixture path").to_string_lossy();
16600+ assert!(
16601+ echo.contains(&*stem),
16602+ "picked {}, echoed {echo}",
16603+ path.display()
16604+ );
16605+ }
16606+ }
16607+
1630516608 /// "und" is what a muxer writes when nobody said what the language is. A
1630616609 /// row showing it verbatim names a language nobody speaks.
1630716610 #[test]