diff --git a/crates/app/src/keymap.rs b/crates/app/src/keymap.rs index f10c8e4..c97134b 100644 --- a/crates/app/src/keymap.rs +++ b/crates/app/src/keymap.rs @@ -244,22 +244,22 @@ impl ActionId { pub fn label(self) -> &'static str { match self { ActionId::Play => "Play / Pause", - ActionId::Loop => "Loop the playhead's end", + ActionId::Loop => "Loop playback", ActionId::StepBack => "One frame back", ActionId::StepForward => "One frame forward", ActionId::JumpBack => "One second back", ActionId::JumpForward => "One second forward", - ActionId::GoStart => "Go to the start", - ActionId::GoEnd => "Go to the last frame", - ActionId::PrevSyncPoint => "Previous sync point (a cut here is copied, not re-encoded)", - ActionId::NextSyncPoint => "Next sync point (a cut here is copied, not re-encoded)", - ActionId::WalkCutNext => "Walk to the next cut", - ActionId::WalkCutPrev => "Walk to the previous cut", - ActionId::WalkCutNext10 => "Walk ten cuts forward", - ActionId::WalkCutPrev10 => "Walk ten cuts back", - ActionId::SetIn => "Mark in (export range)", - ActionId::SetOut => "Mark out (export range)", - ActionId::ClearRange => "Clear the export range", + ActionId::GoStart => "Go to start", + ActionId::GoEnd => "Go to end", + ActionId::PrevSyncPoint => "Previous sync point", + ActionId::NextSyncPoint => "Next sync point", + ActionId::WalkCutNext => "Next cut", + ActionId::WalkCutPrev => "Previous cut", + ActionId::WalkCutNext10 => "Forward ten cuts", + ActionId::WalkCutPrev10 => "Back ten cuts", + ActionId::SetIn => "Mark in", + ActionId::SetOut => "Mark out", + ActionId::ClearRange => "Clear range", ActionId::Export => "Export", ActionId::Save => "Save", ActionId::Copy => "Copy", @@ -269,59 +269,59 @@ impl ActionId { // Neither half's action: it takes the *pair* apart, and the menu // that offers it hangs on whichever half was right-clicked -- worded // from the picture's side it read as a video item on an audio clip. - ActionId::Detach => "Ungroup the selection (clips and captions)", - ActionId::Group => "Group the selection (ctrl-click the clips first)", - ActionId::Select => "Select the clip under the playhead (again for the next lane)", - ActionId::SelectNext => "Select the next clip in the lane", - ActionId::SelectPrev => "Select the previous clip in the lane", - ActionId::SelectAll => "Select everything (every clip and caption)", - ActionId::Deselect => "Clear the selection", + ActionId::Detach => "Ungroup", + ActionId::Group => "Group", + ActionId::Select => "Select clip at playhead", + ActionId::SelectNext => "Select next clip", + ActionId::SelectPrev => "Select previous clip", + ActionId::SelectAll => "Select all", + ActionId::Deselect => "Deselect", ActionId::Delete => "Delete", - ActionId::Lift => "Lift (leave a gap)", + ActionId::Lift => "Lift", ActionId::Color => "Colour…", - ActionId::Transform => "Transform — position, scale, rotation, crop", - ActionId::Fit => "Fit policy: fit → fill → stretch → centre", - ActionId::Resolution => "Project resolution: source → 2160p → 1080p → 720p → 480p", - ActionId::ZoomIn => "Zoom in on the timeline (around the playhead)", - ActionId::ZoomOut => "Zoom out of the timeline", - ActionId::ZoomFit => "Fit the whole timeline on screen", + ActionId::Transform => "Transform…", + ActionId::Fit => "Fit policy", + ActionId::Resolution => "Project resolution", + ActionId::ZoomIn => "Zoom in", + ActionId::ZoomOut => "Zoom out", + ActionId::ZoomFit => "Fit timeline", ActionId::Undo => "Undo", ActionId::Redo => "Redo", - ActionId::AddVideoLane => "Add a video track", - ActionId::AddAudioLane => "Add an audio track", - ActionId::RemoveVideoLane => "Remove the last video track (it must be empty)", - ActionId::RemoveAudioLane => "Remove the last audio track (it must be empty)", - ActionId::AddSubtitleLane => "Add a subtitle track", - ActionId::RemoveSubtitleLane => "Remove the last subtitle track (it must be empty)", - ActionId::ImportSubtitles => "Add subtitles from a file…", + ActionId::AddVideoLane => "Add video track", + ActionId::AddAudioLane => "Add audio track", + ActionId::RemoveVideoLane => "Remove video track", + ActionId::RemoveAudioLane => "Remove audio track", + ActionId::AddSubtitleLane => "Add subtitle track", + ActionId::RemoveSubtitleLane => "Remove subtitle track", + ActionId::ImportSubtitles => "Add subtitles…", ActionId::AddFiles => "Add files…", - ActionId::PasteFilePath => "Paste path (import the file it names)", + ActionId::PasteFilePath => "Paste path", ActionId::ToggleMute => "Mute / Unmute", ActionId::VolumeUp => "Volume up", ActionId::VolumeDown => "Volume down", ActionId::Equalizer => "Equalizer", - ActionId::Speed => "Speed (tape)…", - ActionId::Silence => "Silences: cut or speed up…", - ActionId::Crossfade => "Crossfade into the next clip", - ActionId::TrimIn => "Trim the subject cut's in point", - ActionId::TrimOut => "Trim the subject cut's out point", - ActionId::LoopTrim => "Loop-trim the subject cut", - ActionId::TrimInToPlayhead => "Trim the subject cut's in point to the playhead", - ActionId::TrimOutToPlayhead => "Trim the subject cut's out point to the playhead", - ActionId::Dissolve => "Dissolve into the next clip", - ActionId::Mix => "Mix: track volumes and the limiter…", - ActionId::ToggleSnap => "Snap on / off (edges, the playhead, the start)", - ActionId::ToggleSubtitles => "Subtitles on / off over the picture", - ActionId::ToggleProxies => "Proxies on / off for the picture", - ActionId::ToggleAutoProxies => "Make proxies on import: on / off", - ActionId::Theme => "Theme: the window's colours…", - ActionId::Fullscreen => "Fullscreen on / off", + ActionId::Speed => "Speed…", + ActionId::Silence => "Silences…", + ActionId::Crossfade => "Crossfade to next", + ActionId::TrimIn => "Trim in", + ActionId::TrimOut => "Trim out", + ActionId::LoopTrim => "Loop-trim", + ActionId::TrimInToPlayhead => "Trim in to playhead", + ActionId::TrimOutToPlayhead => "Trim out to playhead", + ActionId::Dissolve => "Dissolve to next", + ActionId::Mix => "Mix…", + ActionId::ToggleSnap => "Snap", + ActionId::ToggleSubtitles => "Subtitles", + ActionId::ToggleProxies => "Proxies", + ActionId::ToggleAutoProxies => "Proxies on import", + ActionId::Theme => "Theme…", + ActionId::Fullscreen => "Fullscreen", ActionId::CancelExport => "Cancel export", - ActionId::ShowActions => "All actions and their keys…", - ActionId::Screenshot => "Save the frame on screen as a PNG", - ActionId::SubtitleStyle => "Subtitle style: font and size…", - ActionId::Settings => "Settings: project and editor…", - ActionId::FocusPanels => "Move keyboard focus between panels", + ActionId::ShowActions => "All actions…", + ActionId::Screenshot => "Save frame as PNG", + ActionId::SubtitleStyle => "Subtitle style…", + ActionId::Settings => "Settings…", + ActionId::FocusPanels => "Focus panels", } } @@ -1681,6 +1681,28 @@ mod tests { assert_eq!(k.display(ActionId::ZoomIn), "ctrl+="); } + /// DESIGN §8: a label names the verb. Prose truncates -- the KEYS list + /// ellipsises it, a menu row's fixed plate cuts it mid-word, a hover plate + /// the same -- so four words is the whole budget, and what a parenthesis + /// used to carry (why an action refuses) lives in the refusal string the + /// oracle and the engine already word. + #[test] + fn a_label_names_the_verb_in_four_words() { + let mut seen: Vec<&'static str> = Vec::new(); + for action in ActionId::ALL { + let label = action.label(); + let words = label.split_whitespace().count(); + assert!(words <= 4, "{action:?}: {words} words -- {label:?}"); + assert!(!label.contains('('), "{action:?}: a parenthesis -- {label:?}"); + assert!( + !label.to_lowercase().starts_with("the "), + "{action:?}: leads with an article -- {label:?}" + ); + assert!(!seen.contains(&label), "two actions both named {label:?}"); + seen.push(label); + } + } + /// [`Keymap::chord`] is the badge's one token, not [`Keymap::display`]'s /// sentence: the primary (first-bound) stroke only, `^` for ctrl, and the /// short names a glyph badge actually has room for. diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 0411406..90c0d4e 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -71,8 +71,8 @@ pub(crate) const RULER_HIT_H: f32 = HIT_MIN; /// 360 px tall window. The rows are click targets, so `HIT_MIN` binds them too. /// Wider than the export card, and for the same reason that one is wider than /// this used to be: at 320 the longest labels ("Remove the last video track (it -/// must be empty)") ran straight over the stroke printed at the other end of -/// their row. Every label in the registry fits beside its stroke here, and the +/// must be empty)", before cleanse round 2 cut every label to its verb) ran +/// straight over the stroke printed at the other end of their row. Every label in the registry fits beside its stroke here, and the /// one that cannot -- a row waiting for a key to be pressed -- truncates rather /// than overprinting. Still inside the 640 px floor. pub(crate) const KEYS_W: f32 = 480.; diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index adc84da..2612718 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2579,11 +2579,11 @@ fn every_action_has_a_darkroom_widget_home_or_explicit_owner() { ]; /// `ActionId::Loop` is a prefix of `ActionId::LoopTrim`, and the keys /// menu's own label arm (`ActionId::ToggleMute | ActionId::Paste => - /// format!("{verb} (global)")`) shapes a string rather than opening a + /// format!("{full} (global)")`) shapes a string rather than opening a /// door -- neither is a widget home, so neither counts as a mention. fn mentions(text: &str, name: &str) -> bool { text.lines() - .filter(|l| !l.contains("=> format!(\"{verb} (global)\")")) + .filter(|l| !l.contains("=> format!(\"{full} (global)\")")) .any(|line| { line.match_indices(&format!("ActionId::{name}")).any(|(i, m)| { !line[i + m.len()..] diff --git a/crates/app/src/ui/dock_stance.rs b/crates/app/src/ui/dock_stance.rs index f2b1898..d012db6 100644 --- a/crates/app/src/ui/dock_stance.rs +++ b/crates/app/src/ui/dock_stance.rs @@ -1265,11 +1265,14 @@ fn keys_tab(player: &Player, cx: &mut Context) -> impl IntoElement { .gap(px(12.)) .child( div() - // The label gives way, never the chord: a long parenthetical - // ("Previous sync point (a cut here is copied...)") pushed - // the chord column clean off the dock's right edge until - // this row took `min_w(0)` + ellipsis, the same shape a - // source row's name already uses. + // The label gives way, never the chord: a long + // parenthetical ("Previous sync point (a cut here is + // copied...)") pushed the chord column clean off the + // dock's right edge until this row took `min_w(0)` + + // ellipsis, the same shape a source row's name already + // uses. The labels are four words at most since cleanse + // round 2, so nothing reaches the ellipsis; it stays for + // the row that is waiting for a key. .flex_1() .min_w(px(0.)) .truncate() diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 402eb5d..512aaed 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -298,24 +298,15 @@ impl Player { // The one item that is not about this clip says so, and says it // here rather than in the registry: the stroke is global too, // but its row in the keys menu is not sitting on a clip. - // The registry's label is a sentence -- it has to be, the keys - // overlay reads the same string -- and a sentence in a 260px - // plate row is cut mid-word by the chord column beside it - // ("Ungroup the selection (clips anc", "Group the selection - // (ctrl-c"). DESIGN §7's rule for the bench applies to a menu - // too: labels never truncate into soup. The verb is the head - // of the sentence, up to its first parenthesis or em-dash; - // the tail is what the row's tooltip carries, so nothing is - // lost, it just stops being drawn over the chord. + // The registry's label is the verb itself now (cleanse round + // 2, `a_label_names_the_verb_in_four_words`): four words at + // most, so it fits a 260px plate beside its chord instead of + // being cut mid-word ("Ungroup the selection (clips anc"). + // Nothing is trimmed here any more -- what a parenthesis used + // to carry is the refusal string in the column beside it. let full = action.label(); - let verb = full - .split_once(" (") - .map(|(head, _)| head) - .or_else(|| full.split_once(" — ").map(|(head, _)| head)) - .or_else(|| full.split_once(": ").map(|(head, _)| head)) - .unwrap_or(full); let label = match action { - ActionId::ToggleMute | ActionId::Paste => format!("{verb} (global)"), + ActionId::ToggleMute | ActionId::Paste => format!("{full} (global)"), // A switch says which way it is set: a row reading "Snap on // / off" beside a chord tells nobody whether snapping is on // right now, which is the one thing the spine's badge did @@ -323,17 +314,17 @@ impl Player { ActionId::ToggleSnap => { format!("Snap — {}", if self.snap { "on" } else { "off" }) } - _ => verb.to_string(), + _ => full.to_string(), }; let say: SharedString = full.to_string().into(); rows.push( row(rows.len()) - // Truncated and shrinkable: a long label ("Transform — - // position, scale, rotation, crop") used to run the - // hint column clean off the fixed-width menu instead - // of sharing the row with it, which is why Transform - // showed no stroke while a short label like Colour's - // did. + // Truncated and shrinkable even so: a long label + // ("Transform — position, scale, rotation, crop") + // used to run the hint column clean off the + // fixed-width menu instead of sharing the row with + // it, which is why Transform showed no stroke while a + // short label like Colour's did. .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) .child(div().min_w(px(0.)).flex_shrink().truncate().child(label)) .child(match refusal.why() {