Merge branch 'worktree-agent-a9aa1b399d640d5a0'
Browse files at this commit3 changed files +111 -31
- crates/app/src/importing.rs +1 -1
- crates/app/src/tests/layout.rs +71 -0
- crates/app/src/ui/dock_stance.rs +39 -30
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
| @@ -2823,3 +2823,74 @@ fn the_lane_bed_clips_its_clips_at_the_pinned_heads() { | |||
| 2823 | pinned lane heads: {bed}" | 2823 | pinned lane heads: {bed}" |
| 2824 | ); | 2824 | ); |
| 2825 | } | 2825 | } |
| 2826 | + | ||
| 2827 | +/// A source row is its name first (user 2026-09-09: "clunky, crowded and | ||
| 2828 | +/// problematic"). At DOCK_W 280 the name used to be the only flexible child | ||
| 2829 | +/// among six, so it measured 0px and the library showed | ||
| 2830 | +/// `● V1 A1 · 2 uses Preview Add ↵ ○` -- every part of a row except the one | ||
| 2831 | +/// thing the row is for. The fix is subtraction, not a hover gate (DESIGN §8): | ||
| 2832 | +/// the name keeps 60% of the row, usage joins the metadata line under it, and | ||
| 2833 | +/// the three verbs shrink to glyph ghosts at the right edge. | ||
| 2834 | +#[test] | ||
| 2835 | +fn a_source_row_shows_its_name_before_anything_else() { | ||
| 2836 | + let dock = src_text("ui/dock_stance.rs"); | ||
| 2837 | + let start = dock.find("fn source_row(").expect("the source row"); | ||
| 2838 | + let row = &dock[start..dock.find("/// Imported subtitle tracks").expect("its end")]; | ||
| 2839 | + assert!( | ||
| 2840 | + row.contains(".min_w(relative(0.6))"), | ||
| 2841 | + "the row name can still collapse under its siblings" | ||
| 2842 | + ); | ||
| 2843 | + assert!( | ||
| 2844 | + !row.contains(".min_w(px(0.))"), | ||
| 2845 | + "the row name is still allowed to measure nothing" | ||
| 2846 | + ); | ||
| 2847 | + // The usage moved to the second line, beside codec/length, in ink3. | ||
| 2848 | + assert!( | ||
| 2849 | + row.contains(r#".child(format!("{usage} · {under}"))"#), | ||
| 2850 | + "usage is not folded into the metadata line" | ||
| 2851 | + ); | ||
| 2852 | + // Preview / Add / proxy are glyph+chord ghosts now, not word buttons: | ||
| 2853 | + // ~66px for the three together, inside the 96px the name can spare. | ||
| 2854 | + for glyph in [r#".child("▷")"#, r#".child("+")"#, r#".child("↵")"#] { | ||
| 2855 | + assert!(row.contains(glyph), "the right-edge verbs lost {glyph}"); | ||
| 2856 | + } | ||
| 2857 | + for word in [r#".child("Preview")"#, r#".child("Add")"#] { | ||
| 2858 | + assert!(!row.contains(word), "{word} still spends the name's width"); | ||
| 2859 | + } | ||
| 2860 | + // Every verb keeps its own hitmap name and its chord. | ||
| 2861 | + for id in ["source.{i}.preview", "source.{i}.add", "source.{i}.proxy"] { | ||
| 2862 | + assert!(row.contains(id), "{id} lost its hitmap entry"); | ||
| 2863 | + } | ||
| 2864 | + // DESIGN §8: the permanent footer telling the editor how to use a list | ||
| 2865 | + // ("drag · ↵ add · double-click plays") is instructional copy and is gone. | ||
| 2866 | + assert!( | ||
| 2867 | + !dock.contains("double-click plays"), | ||
| 2868 | + "the dock still carries an instruction footer" | ||
| 2869 | + ); | ||
| 2870 | + // ...and an Audio tab with no audio-only file in it is a single noun, not | ||
| 2871 | + // the claim `No sound` over a source whose A1 stream is on the bench. | ||
| 2872 | + assert_eq!(crate::LibraryTab::Audio.empty(), "none"); | ||
| 2873 | +} | ||
| 2874 | + | ||
| 2875 | +/// Focus and selection rings are drawn, never inserted: a `when(focused, | ||
| 2876 | +/// border_1())` puts a pixel of box into the flow and every row in the dock | ||
| 2877 | +/// steps sideways the moment the surface takes focus (hunter: h-clip-tab.png | ||
| 2878 | +/// vs i-library-menu.png). | ||
| 2879 | +#[test] | ||
| 2880 | +fn a_dock_ring_never_moves_what_it_rings() { | ||
| 2881 | + let dock = src_text("ui/dock_stance.rs"); | ||
| 2882 | + for gate in [ | ||
| 2883 | + ".when(picked, |d| d.border_1()", | ||
| 2884 | + ".when(focused, |d| d.border_1()", | ||
| 2885 | + ] { | ||
| 2886 | + assert!( | ||
| 2887 | + !dock.contains(gate), | ||
| 2888 | + "a dock ring is still added on state ({gate}), shifting its content" | ||
| 2889 | + ); | ||
| 2890 | + } | ||
| 2891 | + assert_eq!( | ||
| 2892 | + dock.matches("gpui::transparent_black()").count(), | ||
| 2893 | + 4, | ||
| 2894 | + "a dock ring lost its at-rest transparent border" | ||
| 2895 | + ); | ||
| 2896 | +} | ||
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 list | 353 | // 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 one | 354 | // 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 under | 365 | // Remove, Reveal, Properties (DESIGN §9: "verbs of the thing under |
| 359 | // the cursor"). It used to hang off the 8px ink dot alone, and only | 366 | // 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 -- a | 1168 | /// 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() |