diff --git a/crates/app/src/importing.rs b/crates/app/src/importing.rs index 153bf21..b57bf4e 100644 --- a/crates/app/src/importing.rs +++ b/crates/app/src/importing.rs @@ -45,7 +45,7 @@ impl LibraryTab { pub(crate) fn empty(self) -> &'static str { match self { LibraryTab::Media => "No video", - LibraryTab::Audio => "No sound", + LibraryTab::Audio => "none", LibraryTab::Text => "No subtitles", } } diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index ec2a915..9af32f8 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2823,3 +2823,74 @@ fn the_lane_bed_clips_its_clips_at_the_pinned_heads() { pinned lane heads: {bed}" ); } + +/// A source row is its name first (user 2026-09-09: "clunky, crowded and +/// problematic"). At DOCK_W 280 the name used to be the only flexible child +/// among six, so it measured 0px and the library showed +/// `● V1 A1 · 2 uses Preview Add ↵ ○` -- every part of a row except the one +/// thing the row is for. The fix is subtraction, not a hover gate (DESIGN §8): +/// the name keeps 60% of the row, usage joins the metadata line under it, and +/// the three verbs shrink to glyph ghosts at the right edge. +#[test] +fn a_source_row_shows_its_name_before_anything_else() { + let dock = src_text("ui/dock_stance.rs"); + let start = dock.find("fn source_row(").expect("the source row"); + let row = &dock[start..dock.find("/// Imported subtitle tracks").expect("its end")]; + assert!( + row.contains(".min_w(relative(0.6))"), + "the row name can still collapse under its siblings" + ); + assert!( + !row.contains(".min_w(px(0.))"), + "the row name is still allowed to measure nothing" + ); + // The usage moved to the second line, beside codec/length, in ink3. + assert!( + row.contains(r#".child(format!("{usage} · {under}"))"#), + "usage is not folded into the metadata line" + ); + // Preview / Add / proxy are glyph+chord ghosts now, not word buttons: + // ~66px for the three together, inside the 96px the name can spare. + for glyph in [r#".child("▷")"#, r#".child("+")"#, r#".child("↵")"#] { + assert!(row.contains(glyph), "the right-edge verbs lost {glyph}"); + } + for word in [r#".child("Preview")"#, r#".child("Add")"#] { + assert!(!row.contains(word), "{word} still spends the name's width"); + } + // Every verb keeps its own hitmap name and its chord. + for id in ["source.{i}.preview", "source.{i}.add", "source.{i}.proxy"] { + assert!(row.contains(id), "{id} lost its hitmap entry"); + } + // DESIGN §8: the permanent footer telling the editor how to use a list + // ("drag · ↵ add · double-click plays") is instructional copy and is gone. + assert!( + !dock.contains("double-click plays"), + "the dock still carries an instruction footer" + ); + // ...and an Audio tab with no audio-only file in it is a single noun, not + // the claim `No sound` over a source whose A1 stream is on the bench. + assert_eq!(crate::LibraryTab::Audio.empty(), "none"); +} + +/// Focus and selection rings are drawn, never inserted: a `when(focused, +/// border_1())` puts a pixel of box into the flow and every row in the dock +/// steps sideways the moment the surface takes focus (hunter: h-clip-tab.png +/// vs i-library-menu.png). +#[test] +fn a_dock_ring_never_moves_what_it_rings() { + let dock = src_text("ui/dock_stance.rs"); + for gate in [ + ".when(picked, |d| d.border_1()", + ".when(focused, |d| d.border_1()", + ] { + assert!( + !dock.contains(gate), + "a dock ring is still added on state ({gate}), shifting its content" + ); + } + assert_eq!( + dock.matches("gpui::transparent_black()").count(), + 4, + "a dock ring lost its at-rest transparent border" + ); +} diff --git a/crates/app/src/ui/dock_stance.rs b/crates/app/src/ui/dock_stance.rs index f53bf9a..1bcd98d 100644 --- a/crates/app/src/ui/dock_stance.rs +++ b/crates/app/src/ui/dock_stance.rs @@ -353,7 +353,14 @@ fn source_row( // carries no film ink of its own to complement, it is a plain list // line, so the general focus/selection ring applies, the same one // the bench already uses for the same job. - .when(picked, |d| d.border_1().border_color(rgb(INK1()))) + .border_1() + .border_color(match picked { + // The ring is always in flow -- transparent at rest, ink1 when + // picked -- because a `when(picked, border_1())` added a pixel of + // box on selection and shoved every row's text sideways. + true => rgb(INK1()).into(), + false => gpui::transparent_black(), + }) // Right-click ANYWHERE on the row opens the row's menu -- Add, // Remove, Reveal, Properties (DESIGN §9: "verbs of the thing under // the cursor"). It used to hang off the 8px ink dot alone, and only @@ -446,22 +453,22 @@ fn source_row( let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); div() .flex_1() - .min_w(px(0.)) + // FAULT: this was `min_w(px(0.))` -- the row's five + // flex_none siblings (usage, Preview, Add ↵, proxy) + // took their full width first and the name, the one + // thing a row is *for*, collapsed to nothing at the + // default dock width: the library read `● V1 A1 · 2 + // uses Preview Add ↵ ○` with no filename at all. The + // name is the first line and keeps at least 60% of + // the row; the verbs shrank to glyph ghosts and the + // usage moved down to the metadata line. + .min_w(relative(0.6)) .truncate() .font(style.font) .text_size(style.size) .text_color(rgb(INK1())) .child(name) }) - .child({ - let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); - div() - .flex_none() - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK3())) - .child(usage) - }) .when(usable, |d| { d.child({ let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); @@ -490,7 +497,7 @@ fn source_row( .font(style.font) .text_size(style.size) .text_color(rgb(INK2())) - .child("Preview"), + .child("▷"), ) }) }) @@ -544,7 +551,7 @@ fn source_row( .font(label_style.font) .text_size(label_style.size) .text_color(rgb(INK2())) - .child("Add"), + .child("+"), ) .child( div() @@ -612,7 +619,7 @@ fn source_row( .font(style.font) .text_size(style.size) .text_color(rgb(INK3())) - .child(under) + .child(format!("{usage} · {under}")) }) } @@ -707,7 +714,14 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context) -> (usize, Vec rgb(INK1()).into(), + false => gpui::transparent_black(), + }) .when(!usable, |d| d.opacity(0.5)) .when(usable, |d| { d.cursor_pointer() @@ -963,7 +977,11 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context) - .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { cycle_on_key_down(Surface::Dock)(this, event, window, cx) })) - .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) + .border_1() + .border_color(match focused { + true => rgb(STROKE_FOCUS()).into(), + false => gpui::transparent_black(), + }) .flex_1() .min_h(px(0.)) .flex() @@ -1145,19 +1163,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context) - }), )), ) - .child({ - // Metadata, not a row: DESIGN §3's metadata role, and the quietest - // text in the dock: ink3, tight leading so it never competes with - // the source rows above it. - let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); - div() - .flex_none() - .line_height(relative(1.25)) - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK3())) - .child("drag · ↵ add · double-click plays") - }) } /// The transition a clip carries into its immediate successor, if any -- a @@ -1285,7 +1290,11 @@ fn clip_tab( .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { cycle_on_key_down(Surface::Inspector)(this, event, window, cx) })) - .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) + .border_1() + .border_color(match focused { + true => rgb(STROKE_FOCUS()).into(), + false => gpui::transparent_black(), + }) .flex_1() .min_h(px(0.)) .flex()