forge
Explore
Log in

Don't you dare go Hollow

A source row is its name first — the verbs shrink to ghosts

Browse files at this commit

34299ab50daa4a42ff14dc26c2701508b7a2518cAhmet Kaan GümüşParent: 2bf7f4a
  • style
    • a source row is its name first — the verbs shrink to ghosts
Show full message
💄 style(app): a source row is its name first — the verbs shrink to ghosts

At DOCK_W 280 the name was the only flexible child among six and measured 0px: the library read `● V1 A1 · 2 uses Preview Add ↵ ○` with no filename. The name now keeps 60% of the row, usage joins the codec/length line under it, and Preview/Add/proxy are glyph+chord ghosts (~66px together) at the right edge. The instructional footer `drag · ↵ add · double-click plays` goes (DESIGN §8), the Audio tab's empty state is the noun `none` instead of the claim `No sound` over a source whose A1 is on the bench, and the dock's focus/selection rings are transparent-at-rest borders so a ring stops shoving every row 1px sideways.
crates/app/src/importing.rsmodified+1 -1
@@ -45,7 +45,7 @@ impl LibraryTab {
45 pub(crate) fn empty(self) -> &'static str {45 pub(crate) fn empty(self) -> &'static str {
46 match self {46 match self {
47 LibraryTab::Media => "No video",47 LibraryTab::Media => "No video",
48- LibraryTab::Audio => "No sound",48+ LibraryTab::Audio => "none",
49 LibraryTab::Text => "No subtitles",49 LibraryTab::Text => "No subtitles",
50 }50 }
51 }51 }
crates/app/src/tests/layout.rsmodified+71 -0
@@ -2814,3 +2814,74 @@ fn the_lane_bed_clips_its_clips_at_the_pinned_heads() {
2814 pinned lane heads: {bed}"2814 pinned lane heads: {bed}"
2815 );2815 );
2816 }2816 }
2817+
2818+/// A source row is its name first (user 2026-09-09: "clunky, crowded and
2819+/// problematic"). At DOCK_W 280 the name used to be the only flexible child
2820+/// among six, so it measured 0px and the library showed
2821+/// `● V1 A1 · 2 uses Preview Add ↵ ○` -- every part of a row except the one
2822+/// thing the row is for. The fix is subtraction, not a hover gate (DESIGN §8):
2823+/// the name keeps 60% of the row, usage joins the metadata line under it, and
2824+/// the three verbs shrink to glyph ghosts at the right edge.
2825+#[test]
2826+fn a_source_row_shows_its_name_before_anything_else() {
2827+ let dock = src_text("ui/dock_stance.rs");
2828+ let start = dock.find("fn source_row(").expect("the source row");
2829+ let row = &dock[start..dock.find("/// Imported subtitle tracks").expect("its end")];
2830+ assert!(
2831+ row.contains(".min_w(relative(0.6))"),
2832+ "the row name can still collapse under its siblings"
2833+ );
2834+ assert!(
2835+ !row.contains(".min_w(px(0.))"),
2836+ "the row name is still allowed to measure nothing"
2837+ );
2838+ // The usage moved to the second line, beside codec/length, in ink3.
2839+ assert!(
2840+ row.contains(r#".child(format!("{usage} · {under}"))"#),
2841+ "usage is not folded into the metadata line"
2842+ );
2843+ // Preview / Add / proxy are glyph+chord ghosts now, not word buttons:
2844+ // ~66px for the three together, inside the 96px the name can spare.
2845+ for glyph in [r#".child("▷")"#, r#".child("+")"#, r#".child("↵")"#] {
2846+ assert!(row.contains(glyph), "the right-edge verbs lost {glyph}");
2847+ }
2848+ for word in [r#".child("Preview")"#, r#".child("Add")"#] {
2849+ assert!(!row.contains(word), "{word} still spends the name's width");
2850+ }
2851+ // Every verb keeps its own hitmap name and its chord.
2852+ for id in ["source.{i}.preview", "source.{i}.add", "source.{i}.proxy"] {
2853+ assert!(row.contains(id), "{id} lost its hitmap entry");
2854+ }
2855+ // DESIGN §8: the permanent footer telling the editor how to use a list
2856+ // ("drag · ↵ add · double-click plays") is instructional copy and is gone.
2857+ assert!(
2858+ !dock.contains("double-click plays"),
2859+ "the dock still carries an instruction footer"
2860+ );
2861+ // ...and an Audio tab with no audio-only file in it is a single noun, not
2862+ // the claim `No sound` over a source whose A1 stream is on the bench.
2863+ assert_eq!(crate::LibraryTab::Audio.empty(), "none");
2864+}
2865+
2866+/// Focus and selection rings are drawn, never inserted: a `when(focused,
2867+/// border_1())` puts a pixel of box into the flow and every row in the dock
2868+/// steps sideways the moment the surface takes focus (hunter: h-clip-tab.png
2869+/// vs i-library-menu.png).
2870+#[test]
2871+fn a_dock_ring_never_moves_what_it_rings() {
2872+ let dock = src_text("ui/dock_stance.rs");
2873+ for gate in [
2874+ ".when(picked, |d| d.border_1()",
2875+ ".when(focused, |d| d.border_1()",
2876+ ] {
2877+ assert!(
2878+ !dock.contains(gate),
2879+ "a dock ring is still added on state ({gate}), shifting its content"
2880+ );
2881+ }
2882+ assert_eq!(
2883+ dock.matches("gpui::transparent_black()").count(),
2884+ 4,
2885+ "a dock ring lost its at-rest transparent border"
2886+ );
2887+}
crates/app/src/ui/dock_stance.rsmodified+39 -30
@@ -353,7 +353,14 @@ fn source_row(
353 // carries no film ink of its own to complement, it is a plain list353 // carries no film ink of its own to complement, it is a plain list
354 // line, so the general focus/selection ring applies, the same one354 // line, so the general focus/selection ring applies, the same one
355 // the bench already uses for the same job.355 // the bench already uses for the same job.
356- .when(picked, |d| d.border_1().border_color(rgb(INK1())))356+ .border_1()
357+ .border_color(match picked {
358+ // The ring is always in flow -- transparent at rest, ink1 when
359+ // picked -- because a `when(picked, border_1())` added a pixel of
360+ // box on selection and shoved every row's text sideways.
361+ true => rgb(INK1()).into(),
362+ false => gpui::transparent_black(),
363+ })
357 // Right-click ANYWHERE on the row opens the row's menu -- Add,364 // Right-click ANYWHERE on the row opens the row's menu -- Add,
358 // Remove, Reveal, Properties (DESIGN §9: "verbs of the thing under365 // Remove, Reveal, Properties (DESIGN §9: "verbs of the thing under
359 // the cursor"). It used to hang off the 8px ink dot alone, and only366 // the cursor"). It used to hang off the 8px ink dot alone, and only
@@ -446,22 +453,22 @@ fn source_row(
446 let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);453 let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
447 div()454 div()
448 .flex_1()455 .flex_1()
449- .min_w(px(0.))456+ // FAULT: this was `min_w(px(0.))` -- the row's five
457+ // flex_none siblings (usage, Preview, Add ↵, proxy)
458+ // took their full width first and the name, the one
459+ // thing a row is *for*, collapsed to nothing at the
460+ // default dock width: the library read `● V1 A1 · 2
461+ // uses Preview Add ↵ ○` with no filename at all. The
462+ // name is the first line and keeps at least 60% of
463+ // the row; the verbs shrank to glyph ghosts and the
464+ // usage moved down to the metadata line.
465+ .min_w(relative(0.6))
450 .truncate()466 .truncate()
451 .font(style.font)467 .font(style.font)
452 .text_size(style.size)468 .text_size(style.size)
453 .text_color(rgb(INK1()))469 .text_color(rgb(INK1()))
454 .child(name)470 .child(name)
455 })471 })
456- .child({
457- let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
458- div()
459- .flex_none()
460- .font(style.font)
461- .text_size(style.size)
462- .text_color(rgb(INK3()))
463- .child(usage)
464- })
465 .when(usable, |d| {472 .when(usable, |d| {
466 d.child({473 d.child({
467 let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);474 let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);
@@ -490,7 +497,7 @@ fn source_row(
490 .font(style.font)497 .font(style.font)
491 .text_size(style.size)498 .text_size(style.size)
492 .text_color(rgb(INK2()))499 .text_color(rgb(INK2()))
493- .child("Preview"),500+ .child("▷"),
494 )501 )
495 })502 })
496 })503 })
@@ -544,7 +551,7 @@ fn source_row(
544 .font(label_style.font)551 .font(label_style.font)
545 .text_size(label_style.size)552 .text_size(label_style.size)
546 .text_color(rgb(INK2()))553 .text_color(rgb(INK2()))
547- .child("Add"),554+ .child("+"),
548 )555 )
549 .child(556 .child(
550 div()557 div()
@@ -612,7 +619,7 @@ fn source_row(
612 .font(style.font)619 .font(style.font)
613 .text_size(style.size)620 .text_size(style.size)
614 .text_color(rgb(INK3()))621 .text_color(rgb(INK3()))
615- .child(under)622+ .child(format!("{usage} · {under}"))
616 })623 })
617 }624 }
618 625
@@ -707,7 +714,14 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A
707 .pr(px(8.))714 .pr(px(8.))
708 .py(px(4.))715 .py(px(4.))
709 .rounded(px(3.))716 .rounded(px(3.))
710- .when(picked, |d| d.border_1().border_color(rgb(INK1())))717+ .border_1()
718+ .border_color(match picked {
719+ // The ring is always in flow -- transparent at rest, ink1 when
720+ // picked -- because a `when(picked, border_1())` added a pixel of
721+ // box on selection and shoved every row's text sideways.
722+ true => rgb(INK1()).into(),
723+ false => gpui::transparent_black(),
724+ })
711 .when(!usable, |d| d.opacity(0.5))725 .when(!usable, |d| d.opacity(0.5))
712 .when(usable, |d| {726 .when(usable, |d| {
713 d.cursor_pointer()727 d.cursor_pointer()
@@ -963,7 +977,11 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -
963 .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| {977 .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| {
964 cycle_on_key_down(Surface::Dock)(this, event, window, cx)978 cycle_on_key_down(Surface::Dock)(this, event, window, cx)
965 }))979 }))
966- .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS())))980+ .border_1()
981+ .border_color(match focused {
982+ true => rgb(STROKE_FOCUS()).into(),
983+ false => gpui::transparent_black(),
984+ })
967 .flex_1()985 .flex_1()
968 .min_h(px(0.))986 .min_h(px(0.))
969 .flex()987 .flex()
@@ -1145,19 +1163,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -
1145 }),1163 }),
1146 )),1164 )),
1147 )1165 )
1148- .child({
1149- // Metadata, not a row: DESIGN §3's metadata role, and the quietest
1150- // text in the dock: ink3, tight leading so it never competes with
1151- // the source rows above it.
1152- let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
1153- div()
1154- .flex_none()
1155- .line_height(relative(1.25))
1156- .font(style.font)
1157- .text_size(style.size)
1158- .text_color(rgb(INK3()))
1159- .child("drag · ↵ add · double-click plays")
1160- })
1161 }1166 }
1162 1167
1163 /// The transition a clip carries into its immediate successor, if any -- a1168 /// The transition a clip carries into its immediate successor, if any -- a
@@ -1285,7 +1290,11 @@ fn clip_tab(
1285 .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| {1290 .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| {
1286 cycle_on_key_down(Surface::Inspector)(this, event, window, cx)1291 cycle_on_key_down(Surface::Inspector)(this, event, window, cx)
1287 }))1292 }))
1288- .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS())))1293+ .border_1()
1294+ .border_color(match focused {
1295+ true => rgb(STROKE_FOCUS()).into(),
1296+ false => gpui::transparent_black(),
1297+ })
1289 .flex_1()1298 .flex_1()
1290 .min_h(px(0.))1299 .min_h(px(0.))
1291 .flex()1300 .flex()