forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'main' into worktree-agent-a00e58d10c32a96d0

Browse files at this commit

e1b0b68129d561bec3bee4d97a87b1c139e3e6f1Ahmet Kaan GümüşParent: c5971dff916eb3
crates/app/src/export_ui.rsmodified+5 -22
@@ -724,32 +724,15 @@ pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option<u
724 /// The faintest line on the moment: what the export resolved to on its own --724 /// The faintest line on the moment: what the export resolved to on its own --
725 /// the codec, the sound, whether it is the whole film or the marked span, and725 /// the codec, the sound, whether it is the whole film or the marked span, and
726 /// which seat writes the picture. A readout, never a control: everything in it726 /// which seat writes the picture. A readout, never a control: everything in it
727-/// is set in Settings now.727+/// The span an export writes, in the words row 3 says it in: the marked
728-pub(crate) fn plan_line(728+/// range where there is one, the whole timeline otherwise -- and "sound only"
729- format: Format,729+/// for a file that carries no picture at all.
730- audio: &str,730+pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String {
731- marks: Option<&str>,731+ match (marks, has_video) {
732- hardware: bool,
733-) -> String {
734- let mut parts: Vec<String> = Vec::new();
735- if format.has_video() {
736- parts.push(format_label(format).to_string());
737- }
738- if !audio.is_empty() {
739- parts.push(audio.to_string());
740- }
741- parts.push(match (marks, format.has_video()) {
742 (Some(marks), _) => format!("marks {marks}"),732 (Some(marks), _) => format!("marks {marks}"),
743 (None, true) => "whole film".to_string(),733 (None, true) => "whole film".to_string(),
744 (None, false) => "sound only".to_string(),734 (None, false) => "sound only".to_string(),
745- });
746- if format.has_video() {
747- parts.push(match hardware {
748- true => "GPU".to_string(),
749- false => "SW".to_string(),
750- });
751 }735 }
752- parts.join(" · ")
753 }736 }
754 737
755 /// A clip's share of the lane. A timeline with no length reads as one full-width738 /// A clip's share of the lane. A timeline with no length reads as one full-width
crates/app/src/player/cards.rsmodified+2 -2
@@ -1827,7 +1827,7 @@ impl Player {
1827 return true;1827 return true;
1828 }1828 }
1829 // The settings page's EXPORT rows: `c` steps the file, `b` the rate1829 // The settings page's EXPORT rows: `c` steps the file, `b` the rate
1830- // its sound is coded at and `e` the encoder seat. Card-local like the1830+ // its sound is coded at and `g` the encoder seat. Card-local like the
1831 // colour and transform branches above -- and only these three, so1831 // colour and transform branches above -- and only these three, so
1832 // escape still closes the page and every other key falls through to1832 // escape still closes the page and every other key falls through to
1833 // the room.1833 // the room.
@@ -1835,7 +1835,7 @@ impl Player {
1835 match key {1835 match key {
1836 "c" => self.cycle_export_picture(),1836 "c" => self.cycle_export_picture(),
1837 "b" => self.cycle_audio_kbps(),1837 "b" => self.cycle_audio_kbps(),
1838- "e" => self.cycle_encoder(cx),1838+ "g" => self.cycle_encoder(cx),
1839 _ => return false,1839 _ => return false,
1840 }1840 }
1841 return true;1841 return true;
crates/app/src/player/export.rsmodified+14 -0
@@ -648,6 +648,20 @@ impl Player {
648 "d" => self.pick_destination(cx),648 "d" => self.pick_destination(cx),
649 "n" => self.edit_budget(),649 "n" => self.edit_budget(),
650 "e" | "enter" => self.start_export(cx),650 "e" | "enter" => self.start_export(cx),
651+ // The encode options, on the moment that spends them (user
652+ // 2026-09-09: "couldn't find how to change encode options") --
653+ // the Settings room's own `c`/`b`/`g` setters, so the two
654+ // surfaces can never say different things. `g` and not `e`
655+ // because `e` is this moment's Export, and a ghost wears no
656+ // shifted letter (DESIGN §4).
657+ "c" => self.cycle_export_picture(),
658+ "b" => self.cycle_audio_kbps(),
659+ "g" => self.cycle_encoder(cx),
660+ // corner-cut: the settings door answers a bare `,` as well as the
661+ // room's `^,` it wears, because `param_card_key` is handed shift
662+ // only -- ceiling: no modifier reaches a card's keys. Upgrade:
663+ // thread `Modifiers` through `ui::stance`'s handler.
664+ "," => self.open_settings(cx),
651 "up" | "right" | "+" | "=" => self.nudge_budget(1, shift),665 "up" | "right" | "+" | "=" => self.nudge_budget(1, shift),
652 "down" | "left" | "-" => self.nudge_budget(-1, shift),666 "down" | "left" | "-" => self.nudge_budget(-1, shift),
653 _ => {}667 _ => {}
crates/app/src/tests/cards.rsmodified+61 -1
@@ -1045,11 +1045,71 @@ fn a_chord_the_export_moment_answers_never_reaches_the_room() {
1045 assert!(typing.contains("self.budget_edit = None"), "esc leaves the field");1045 assert!(typing.contains("self.budget_edit = None"), "esc leaves the field");
1046 assert!(closed.contains("self.close_card()"), "then esc closes the moment");1046 assert!(closed.contains("self.close_card()"), "then esc closes the moment");
1047 // Its chords, all of them consumed here rather than by the keymap.1047 // Its chords, all of them consumed here rather than by the keymap.
1048- for chord in ["\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\""] {1048+ for chord in [
1049+ "\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\"", "\"c\"", "\"b\"", "\"g\"",
1050+ "\",\"",
1051+ ] {
1049 assert!(closed.contains(chord), "{chord} is not the moment's own");1052 assert!(closed.contains(chord), "{chord} is not the moment's own");
1050 }1053 }
1051 }1054 }
1052 1055
1056+/// The user could not find the encode options from the moment that spends
1057+/// them ("simplifying doesn't mean getting rid of advanced settings"): row 3
1058+/// now *is* the options -- three ghost segments carrying the Settings room's
1059+/// own setters, plus the door to the rest of that room.
1060+#[test]
1061+fn row_three_wears_the_encode_options_and_the_door_to_the_rest() {
1062+ let cards = src_text("ui/cards.rs");
1063+ let start = cards.find("fn export_card(").expect("the moment");
1064+ let body = &cards[start..start + cards[start..].find("\n /// ").unwrap_or(cards.len() - start)];
1065+ // A segment is the setter it names, not a readout of it.
1066+ for (id, chord, setter) in [
1067+ ("moment-picture", "\"c\"", "cycle_export_picture"),
1068+ ("moment-sound", "\"b\"", "cycle_audio_kbps"),
1069+ ("moment-encoder", "\"g\"", "cycle_encoder"),
1070+ ] {
1071+ assert!(body.contains(id), "row 3 lost its {id} segment");
1072+ assert!(body.contains(chord), "the {id} segment wears no chord");
1073+ assert!(body.contains(setter), "the {id} segment changes nothing");
1074+ }
1075+ // The door, wearing the room's own chord rather than a hand-typed one.
1076+ assert!(body.contains("moment-settings"), "row 3 has no settings door");
1077+ assert!(
1078+ body.contains("self.keymap.chord(ActionId::Settings)"),
1079+ "the door's chord is not read from the keymap"
1080+ );
1081+ assert!(body.contains("open_settings"), "the door opens nothing");
1082+ // Quiet, and a control: ink3 with the chord in ink4 (DESIGN §4), never
1083+ // the ink4 line the plan used to be.
1084+ let seg = cards
1085+ .find("fn moment_segment(")
1086+ .map(|at| &cards[at..at + 1200])
1087+ .expect("the segment atom");
1088+ assert!(seg.contains("INK3()") && seg.contains("INK4()"));
1089+ assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover");
1090+}
1091+
1092+/// One chord per thing, said the same on both surfaces: the moment's segments
1093+/// and the Settings room's EXPORT rows drive the same setters, so a chord that
1094+/// drifted on one of them would teach the user a key the other refuses.
1095+#[test]
1096+fn the_moment_and_the_settings_room_wear_the_same_export_chords() {
1097+ let settings = src_text("ui/settings_stance.rs");
1098+ let moment = src_text("ui/cards.rs");
1099+ let player = src_text("player/cards.rs");
1100+ let handler = fn_body("export_moment_key");
1101+ for chord in ["\"c\"", "\"b\"", "\"g\""] {
1102+ assert!(settings.contains(chord), "the EXPORT rows lost {chord}");
1103+ assert!(moment.contains(chord), "row 3 lost {chord}");
1104+ assert!(handler.contains(chord), "the moment answers no {chord}");
1105+ assert!(player.contains(chord), "the settings page answers no {chord}");
1106+ }
1107+ // `e` stays the Export press: the encoder seat took `g` rather than a
1108+ // shifted letter, which no ghost wears.
1109+ assert!(handler.contains("\"e\" | \"enter\" => self.start_export"));
1110+ assert!(!settings.contains("\n \"e\","), "the Encoder row took `e` back");
1111+}
1112+
1053 /// The Sound row: what it offers, and that the pick travels to the engine1113 /// The Sound row: what it offers, and that the pick travels to the engine
1054 /// for a *video* export as much as for an MP3 -- both files carry sound, so1114 /// for a *video* export as much as for an MP3 -- both files carry sound, so
1055 /// a row that only reached the audio formats would be half a control.1115 /// a row that only reached the audio formats would be half a control.
crates/app/src/tests/layout.rsmodified+1 -1
@@ -3376,7 +3376,7 @@ fn the_export_section_is_four_rows_and_no_fifth() {
3376 );3376 );
3377 // Every row wears its chord (DESIGN §4): three keyed rows plus the3377 // Every row wears its chord (DESIGN §4): three keyed rows plus the
3378 // range's own marks, which are keymap actions.3378 // range's own marks, which are keymap actions.
3379- for chord in ["\"c\"", "\"b\"", "\"e\"", "ActionId::SetIn"] {3379+ for chord in ["\"c\"", "\"b\"", "\"g\"", "ActionId::SetIn"] {
3380 assert!(body.contains(chord), "an EXPORT row lost its chord {chord}");3380 assert!(body.contains(chord), "an EXPORT row lost its chord {chord}");
3381 }3381 }
3382 }3382 }
crates/app/src/tests/media.rsmodified+7 -11
@@ -690,18 +690,14 @@ fn the_budget_row_states_the_size_before_it_is_written() {
690 assert_eq!(rate_label(6_000_000), "6.0");690 assert_eq!(rate_label(6_000_000), "6.0");
691 assert_eq!(rate_label(6_500_000), "6.5");691 assert_eq!(rate_label(6_500_000), "6.5");
692 assert_eq!(rate_label(BPS_MIN), "1.0");692 assert_eq!(rate_label(BPS_MIN), "1.0");
693- // The faintest line: what resolved, never a control -- and it says the693+ // Row 3's range readout: the marked span where there is one, and a
694- // marked span where there is one rather than "whole film".694+ // sound-only file names no film to take a range from.
695- let line = plan_line(Format::Mp4, "AAC 256 kbps", None, true);695+ assert_eq!(range_word(None, true), "whole film");
696- assert_eq!(line, "H.264 · AAC 256 kbps · whole film · GPU");696+ assert_eq!(range_word(None, false), "sound only");
697- assert!(plan_line(Format::Mp4, "AAC", None, false).ends_with("SW"));697+ assert_eq!(
698- assert!(698+ range_word(Some("00:00:04:00\u{2013}00:00:12:00"), true),
699- plan_line(Format::Mp4, "AAC", Some("00:00:04:00–00:00:12:00"), true)699+ "marks 00:00:04:00\u{2013}00:00:12:00"
700- .contains("marks 00:00:04:00–00:00:12:00")
701 );700 );
702- // A sound-only export names no picture codec and no seat to write it on.
703- let sound = plan_line(Format::Flac, "FLAC", None, true);
704- assert_eq!(sound, "FLAC · sound only");
705 }701 }
706 702
707 /// Which cue is on screen when: the whole of what the overlay decides, and703 /// Which cue is on screen when: the whole of what the overlay decides, and
crates/app/src/tests/mod.rsmodified+1 -1
@@ -27,7 +27,7 @@ use super::{
27 export_settings, format_refusal, fps_choices, fps_label, frac_along, frac_down,27 export_settings, format_refusal, fps_choices, fps_label, frac_along, frac_down,
28 frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h,28 frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h,
29 marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play,29 marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play,
30- notice_tone, panel_h, parse_budget, plan_line, project_path, proxies_to_start, push_notice, px_below, retarget,30+ notice_tone, panel_h, parse_budget, project_path, range_word, proxies_to_start, push_notice, px_below, retarget,
31 row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label,31 row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label,
32 rate_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal,32 rate_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal,
33 subtitle_plan, timecode, timeline_fixed_h, tip_may_paint,33 subtitle_plan, timecode, timeline_fixed_h, tip_may_paint,
crates/app/src/ui/cards.rsmodified+140 -10
@@ -209,6 +209,45 @@ fn dark_step_glyph(
209 .child(dark_row_value(if plus { "+" } else { "−" }))209 .child(dark_row_value(if plus { "+" } else { "−" }))
210 }210 }
211 211
212+/// One segment of the export moment's plan line (row 3): the thing it says
213+/// *is* the button that changes it, so `H.264 \u{b7} MP4` is pressed to walk the
214+/// files and wears `c` beside it exactly as the Settings row does (user
215+/// 2026-09-09: "couldn't find how to change encode options, simplifying
216+/// doesn't mean getting rid of advanced settings"). A ghost (DESIGN \u{a7}4) at a
217+/// readout's size: `ink3` at rest so the line stays as quiet as the one it
218+/// replaced, `ink2` and one fill step on hover, the chord in `ink4` beside it.
219+fn moment_segment(
220+ id: &'static str,
221+ text: impl Into<SharedString>,
222+ chord: impl Into<SharedString>,
223+ on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
224+) -> impl IntoElement {
225+ let text: SharedString = text.into();
226+ let hitmap = hitmap::enabled().then(|| {
227+ let label = text.clone();
228+ hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true)
229+ });
230+ div()
231+ .id(id)
232+ .flex_none()
233+ .flex()
234+ .items_baseline()
235+ .gap(px(5.))
236+ .px(px(4.))
237+ .rounded(px(3.))
238+ .cursor_pointer()
239+ .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2())))
240+ .on_click(on_click)
241+ .children(hitmap.flatten())
242+ .type_style(type_scale::mono(
243+ type_scale::CHORD_METADATA_MIN_PX,
244+ gpui::FontWeight::MEDIUM,
245+ ))
246+ .text_color(rgb(INK3()))
247+ .child(text)
248+ .child(div().flex_none().text_color(rgb(INK4())).child(chord.into()))
249+}
250+
212 fn dark_ghost_button(251 fn dark_ghost_button(
213 id: impl Into<gpui::ElementId>,252 id: impl Into<gpui::ElementId>,
214 text: impl Into<SharedString>,253 text: impl Into<SharedString>,
@@ -323,7 +362,33 @@ impl Player {
323 timecode(f64::from(end) / self.fps, self.fps),362 timecode(f64::from(end) / self.fps, self.fps),
324 )363 )
325 });364 });
326- let plan = plan_line(self.format, audio, marks.as_deref(), hardware);365+ // Row 3's segments are the Settings room's own EXPORT rows worn as
366+ // ghosts on the line that used to only *report* them -- the same
367+ // setters, so both surfaces can never disagree.
368+ // What the engine says the sound *will* be ("AAC 256 kbps", or "AAC
369+ // copy" where the source's own stream is carried through): a rate
370+ // nobody is choosing wears no chord, the Settings row's own rule for
371+ // a codec with no rate to pick.
372+ let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format);
373+ let sound_label = match audio.is_empty() {
374+ true => codec.to_string(),
375+ false => audio.to_string(),
376+ };
377+ let sound_keyed = rated && !audio.contains("copy");
378+ // `auto` is a promise until the probe answers; once it has, the seat
379+ // says what it resolved to rather than the word nobody picked.
380+ let seat = self.encoder_seat();
381+ let seat_label = match seat {
382+ EncoderSeat::Auto => format!(
383+ "auto \u{2192} {}",
384+ match hardware {
385+ true => "GPU",
386+ false => "SW",
387+ }
388+ ),
389+ _ => crate::ui::settings_stance::encoder_word(seat).to_string(),
390+ };
391+ let range = range_word(marks.as_deref(), self.format.has_video());
327 // The refusal the button used to carry, said before it is pressed and392 // The refusal the button used to carry, said before it is pressed and
328 // in the readout's own place: a few words and the chord that fixes it,393 // in the readout's own place: a few words and the chord that fixes it,
329 // never the sentence the old card wrapped over three lines.394 // never the sentence the old card wrapped over three lines.
@@ -530,17 +595,82 @@ impl Player {
530 div()595 div()
531 .flex_1()596 .flex_1()
532 .min_w(px(0.))597 .min_w(px(0.))
533- .truncate()598+ .flex()
534- .type_style(type_scale::mono(599+ .items_baseline()
535- type_scale::CHORD_METADATA_MIN_PX,600+ .gap(px(6.))
536- gpui::FontWeight::MEDIUM,601+ .children(self.format.has_video().then(|| {
537- ))602+ moment_segment(
538- .text_color(rgb(match blocked.is_some() {603+ "moment-picture",
539- true => STATUS_WARNING(),604+ crate::ui::settings_stance::picture_label(self.format),
540- false => INK4(),605+ "c",
606+ cx.listener(|this, _: &ClickEvent, _, cx| {
607+ this.cycle_export_picture();
608+ cx.notify();
609+ }),
610+ )
611+ }))
612+ .children(sound_keyed.then(|| {
613+ moment_segment(
614+ "moment-sound",
615+ sound_label.clone(),
616+ "b",
617+ cx.listener(|this, _: &ClickEvent, _, cx| {
618+ this.cycle_audio_kbps();
619+ cx.notify();
620+ }),
621+ )
622+ }))
623+ // A codec with no rate to pick is a readout, not a button
624+ // that would do nothing when pressed -- the Settings row's
625+ // own rule.
626+ .children((!sound_keyed).then(|| {
627+ div()
628+ .flex_none()
629+ .type_style(type_scale::mono(
630+ type_scale::CHORD_METADATA_MIN_PX,
631+ gpui::FontWeight::MEDIUM,
632+ ))
633+ .text_color(rgb(INK4()))
634+ .child(sound_label.clone())
541 }))635 }))
542- .child(blocked.clone().unwrap_or(plan)),636+ .children(self.format.has_video().then(|| {
637+ moment_segment(
638+ "moment-encoder",
639+ seat_label.clone(),
640+ "g",
641+ cx.listener(|this, _: &ClickEvent, _, cx| {
642+ this.cycle_encoder(cx);
643+ }),
644+ )
645+ }))
646+ // The range is set on the timeline with the marks
647+ // themselves, so here it is what the file will hold --
648+ // or, where the press would be refused, the refusal in
649+ // its place (DESIGN \u{a7}8: said before it is pressed).
650+ .child(
651+ div()
652+ .flex_1()
653+ .min_w(px(0.))
654+ .truncate()
655+ .type_style(type_scale::mono(
656+ type_scale::CHORD_METADATA_MIN_PX,
657+ gpui::FontWeight::MEDIUM,
658+ ))
659+ .text_color(rgb(match blocked.is_some() {
660+ true => STATUS_WARNING(),
661+ false => INK4(),
662+ }))
663+ .child(blocked.clone().unwrap_or(range)),
664+ ),
543 )665 )
666+ // The door to everything else this file could be written as: the
667+ // room's own settings chord, on the moment that needed it.
668+ .child(moment_segment(
669+ "moment-settings",
670+ "settings",
671+ self.keymap.chord(ActionId::Settings),
672+ cx.listener(|this, _: &ClickEvent, _, cx| this.open_settings(cx)),
673+ ))
544 .child(674 .child(
545 div()675 div()
546 .id("export-confirm")676 .id("export-confirm")
crates/app/src/ui/settings_stance.rsmodified+1 -1
@@ -634,7 +634,7 @@ fn export_section(player: &Player, cx: &mut Context<Player>) -> impl IntoElement
634 "Encoder",634 "Encoder",
635 encoder_word(seat),635 encoder_word(seat),
636 "which encoder writes the picture: the GPU where this machine has a seat, or the CPU",636 "which encoder writes the picture: the GPU where this machine has a seat, or the CPU",
637- "e",637+ "g",
638 av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())),638 av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())),
639 player,639 player,
640 cx.listener(|this, _: &ClickEvent, _, cx| {640 cx.listener(|this, _: &ClickEvent, _, cx| {