From 9e2bfd6ee13719011957b2b5880bce15e4c1e784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 10:04:15 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ui):=20the=20seam=20loses=20?= =?UTF-8?q?its=20hue=20and=20the=20chords=20become=20reachable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The verifier drove the room and found three faults. DARK_SEAM carries an alpha byte, but the stance handed it to rgb(), so every seam between regions painted pure blue — the first law broken in the first screenshot. It goes through rgba() now, a sweep found no other constant of that shape mismatched, and a new test catches the class: the old guard only grepped colour literals, so a hue arriving through a theme constant sailed past it. The stance root read keys with no modal guards, so Home seeked the playhead while the dock's Colour card was open, and Delete and Cut were reachable the same way. It now asks the same shared predicate the legacy room asks. Actions whose surfaces the stance does not draw yet are suppressed rather than left setting invisible state. gpui clears the shift modifier for every symbol key and hands over the shifted glyph instead, so Chord.shift and lookup_shifted never had a production caller and the stride-ten walk could not fire. The dead machinery is gone; stride ten is its own pair of actions on < and >, and selection moves to { and } — on shift+[ it had become keyboard-dead, a regression the legacy room was carrying too. --- crates/app/src/keymap.rs | 194 +++++++++++++++---------------- crates/app/src/main.rs | 8 -- crates/app/src/oracle.rs | 2 + crates/app/src/player/actions.rs | 21 +++- crates/app/src/tests/layout.rs | 34 ++++++ crates/app/src/tests/view.rs | 1 - crates/app/src/ui/overlays.rs | 1 - crates/app/src/ui/stance.rs | 42 +++++-- 8 files changed, 180 insertions(+), 123 deletions(-) diff --git a/crates/app/src/keymap.rs b/crates/app/src/keymap.rs index a24331a..9ebd283 100644 --- a/crates/app/src/keymap.rs +++ b/crates/app/src/keymap.rs @@ -81,10 +81,20 @@ actions! { PrevSyncPoint, NextSyncPoint, /// Walks to the next cut (DESIGN.md §6): the odometer the cut readout - /// counts against. Shift strides ten cuts instead of one. + /// counts against. WalkCutNext, - /// The pair's other half, one cut earlier. Shift strides ten. + /// The pair's other half, one cut earlier. WalkCutPrev, + /// [`ActionId::WalkCutNext`]'s stride-ten (DESIGN.md §6's "shift"): its + /// own action, not a modifier read off `WalkCutNext`, because gpui 0.2.2 + /// never delivers a shift modifier alongside `.`/`,` (see [`Chord`]'s + /// doc) -- the *only* channel a stroke has back to [`Player::act`] is + /// which [`ActionId`] the keymap resolved it to, so the stride the + /// platform can't spell as a modifier is spelled as its own bound key + /// (`>`, what shift+. actually types) instead. + WalkCutNext10, + /// The pair's other half (`<`, what shift+, actually types). + WalkCutPrev10, /// Marks the playhead as an export's in point. The out point wraps around /// it if the mark lands past the current out ([`ordered_range`]). SetIn, @@ -145,11 +155,12 @@ actions! { Crossfade, /// No-aim trim of the subject cut's in point, frame detents, at any zoom /// (DESIGN.md §6), on its designed bare `[`. [`ActionId::SelectPrev`] - /// moved to shift+[ to free it -- see keymap.rs's own defaults. + /// moved to `{` (what shift+[ actually types) to free it -- see + /// keymap.rs's own defaults. TrimIn, /// The pair's other half, the subject cut's out point, on its designed - /// bare `]` -- [`ActionId::SelectNext`] moved to shift+] for the same - /// reason. + /// bare `]` -- [`ActionId::SelectNext`] moved to `}` (what shift+] + /// actually types) for the same reason. TrimOut, /// Loop-trim: loops around the subject cut while trimming it (DESIGN.md /// §6, "the modernized Avid trim mode"). @@ -208,8 +219,10 @@ impl ActionId { 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 (shift: ten cuts)", - ActionId::WalkCutPrev => "Walk to the previous cut (shift: ten cuts)", + 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", @@ -287,6 +300,8 @@ impl ActionId { ActionId::NextSyncPoint => "next-sync-point", ActionId::WalkCutNext => "walk-cut-next", ActionId::WalkCutPrev => "walk-cut-prev", + ActionId::WalkCutNext10 => "walk-cut-next-10", + ActionId::WalkCutPrev10 => "walk-cut-prev-10", ActionId::SetIn => "set-in", ActionId::SetOut => "set-out", ActionId::ClearRange => "clear-range", @@ -366,6 +381,8 @@ impl ActionId { | ActionId::NextSyncPoint | ActionId::WalkCutNext | ActionId::WalkCutPrev + | ActionId::WalkCutNext10 + | ActionId::WalkCutPrev10 | ActionId::SetIn | ActionId::SetOut | ActionId::ClearRange => Category::Playback, @@ -796,27 +813,35 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 35]> = std::sync::LazyLock::new(|| ] }); -/// A stroke as the key handler sees it: gpui's key name plus the two -/// modifiers this editor binds. Nothing else is a chord here -- alt is part -/// of the key name gpui reports, and a third modifier would need the file +/// A stroke as the key handler sees it: gpui's key name plus the one +/// modifier this editor binds. Nothing else is a chord here -- alt is part +/// of the key name gpui reports, and a second modifier would need the file /// format to grow before it could be spelled. +/// +/// There is no `shift` field. gpui 0.2.2 (linux/platform.rs:909-917) clears +/// the shift modifier for any single-char key whose upper and lower case are +/// the same -- every symbol key (`,` `.` `[` `]` `/` `=` ...) -- so a chord +/// carrying `shift` could never be struck for any of them; the shifted +/// stroke arrives instead as the key it types (`shift+.` is the key `>`). +/// The one place this editor wanted shift on a symbol (the odometer's +/// stride-ten, DESIGN.md §6) is bound on that literal key instead +/// (`keymap.rs`'s own `defaults`), and a non-symbol key that wants shift +/// (the EQ card's arrows) reads `event.keystroke.modifiers.shift` straight +/// off the keystroke, upstream of this struct entirely -- so the field had +/// zero production callers and is gone rather than kept dead. #[derive(Clone, PartialEq, Eq, Debug)] pub struct Chord { pub key: String, pub ctrl: bool, - pub shift: bool, } impl Chord { - /// The file's spelling, and the only one [`parse`] accepts back. Ctrl - /// always comes before shift, so a chord round-trips through one spelling - /// and not two. + /// The file's spelling, and the only one [`parse`] accepts back. fn text(&self) -> String { - match (self.ctrl, self.shift) { - (true, true) => format!("ctrl+shift+{}", self.key), - (true, false) => format!("ctrl+{}", self.key), - (false, true) => format!("shift+{}", self.key), - (false, false) => self.key.clone(), + if self.ctrl { + format!("ctrl+{}", self.key) + } else { + self.key.clone() } } @@ -830,11 +855,10 @@ impl Chord { } else { &self.key }; - match (self.ctrl, self.shift) { - (true, true) => format!("ctrl+shift+{key}"), - (true, false) => format!("ctrl+{key}"), - (false, true) => format!("shift+{key}"), - (false, false) => key.to_string(), + if self.ctrl { + format!("ctrl+{key}") + } else { + key.to_string() } } @@ -848,19 +872,15 @@ impl Chord { Chord::parse(&self.text(), 0).is_ok_and(|round_trip| round_trip == *self) } - /// Strict: exactly one optional `ctrl+`, then one optional `shift+`, then - /// a key gpui could have reported. A spelling this cannot emit back - /// unchanged is refused rather than normalised, because the round-trip is - /// what makes the file editable by hand at all. + /// Strict: exactly one optional `ctrl+`, then a key gpui could have + /// reported. A spelling this cannot emit back unchanged is refused + /// rather than normalised, because the round-trip is what makes the file + /// editable by hand at all. fn parse(text: &str, n: usize) -> Result { - let (ctrl, rest) = match text.strip_prefix("ctrl+") { + let (ctrl, key) = match text.strip_prefix("ctrl+") { Some(rest) => (true, rest), None => (false, text), }; - let (shift, key) = match rest.strip_prefix("shift+") { - Some(key) => (true, key), - None => (false, rest), - }; if key.is_empty() || key.contains(' ') || key.contains('+') @@ -871,7 +891,6 @@ impl Chord { Ok(Chord { key: key.to_string(), ctrl, - shift, }) } } @@ -901,15 +920,6 @@ impl Keymap { chord: Chord { key: key.to_string(), ctrl, - shift: false, - }, - }; - let bshift = |action, key: &str| Binding { - action, - chord: Chord { - key: key.to_string(), - ctrl: false, - shift: true, }, }; Keymap { @@ -938,11 +948,17 @@ impl Keymap { b(ActionId::PrevSyncPoint, "[", true), b(ActionId::NextSyncPoint, "]", true), // The cut odometer (DESIGN.md §6): bare walks one cut, shift - // strides ten. Both were free. + // strides ten. gpui 0.2.2 (linux/platform.rs:909-917) clears + // the shift modifier for any single-char key whose upper and + // lower case are the same -- every one of these symbols -- + // so `shift+.` never arrives; what arrives instead is the + // key the shifted stroke actually types, `>`/`<`. Bound + // directly, on the same physical chord, since that is what + // the platform hands the key handler. b(ActionId::WalkCutNext, ".", false), - bshift(ActionId::WalkCutNext, "."), b(ActionId::WalkCutPrev, ",", false), - bshift(ActionId::WalkCutPrev, ","), + b(ActionId::WalkCutNext10, ">", false), + b(ActionId::WalkCutPrev10, "<", false), // The mark pair, on the letters every editor already means them // by: bare, since a mark is set as often as a step and nothing // else in this table answers to either. @@ -968,16 +984,19 @@ impl Keymap { b(ActionId::Detach, "d", false), b(ActionId::Group, "g", true), // Selection without a pointer. Tab is what a keyboard already - // means by "move on to the next thing", and the two brackets + // means by "move on to the next thing", and the two braces // are the pair either side of it in the lane -- shift+tab is // the obvious partner and is unspellable here, since a chord // carries only ctrl and `parse` refuses an uppercase key. Bare // brackets are DESIGN.md §6's own trim pair now, so selection - // takes the shifted chord: same two keys, the modifier telling - // "walk the lane" apart from "trim the cut". + // takes the braces the shifted brackets actually type: same + // two keys, telling "walk the lane" apart from "trim the cut". b(ActionId::Select, "tab", false), - bshift(ActionId::SelectNext, "]"), - bshift(ActionId::SelectPrev, "["), + // Same platform fact as the odometer above: shift+] never + // arrives as shift+], it arrives as the key `}` (and shift+[ + // as `{`) -- bound on the literal the platform delivers. + b(ActionId::SelectNext, "}", false), + b(ActionId::SelectPrev, "{", false), // Select-all, on the chord every editor and every text field // already means it by -- which is why the audio-lane removal // below had to move off ctrl+a: a stroke that universal was @@ -1064,10 +1083,11 @@ impl Keymap { // (below) -- the same letter, the modifier telling them apart. b(ActionId::Crossfade, "f", true), // DESIGN.md §6's own chords: bare `[` `]` are the no-aim trim - // pair. SelectPrev/SelectNext moved to shift+[ shift+] above - // to make room -- the bare bracket trims the subject cut, - // the shifted one walks the selection past it, so the family - // reads as one idea under one pair of keys. + // pair. SelectPrev/SelectNext moved to `{` `}` above to make + // room -- the bare bracket trims the subject cut, the brace + // (what the shifted bracket actually types) walks the + // selection past it, so the family reads as one idea under + // one pair of keys. b(ActionId::TrimIn, "[", false), b(ActionId::TrimOut, "]", false), // Loop-trim (DESIGN.md §6, "the modernized Avid trim mode"): @@ -1133,20 +1153,12 @@ impl Keymap { } /// What a stroke means, if anything. `key` is gpui's key name and `ctrl` its - /// control modifier -- the pair the key handler already matches on. + /// control modifier -- the pair the key handler already matches on. There + /// is no shift parameter: see [`Chord`]'s own doc for why. pub fn lookup(&self, key: &str, ctrl: bool) -> Option { - self.lookup_shifted(key, ctrl, false) - } - - /// [`Keymap::lookup`] plus the shift modifier, for a stroke like - /// `shift+.` (the cut odometer's stride-ten). The key handler does not - /// pass shift yet -- that is the dispatch task's wiring, not this one's -- - /// so every current caller goes through the two-argument [`Keymap::lookup`] - /// above and only ever reaches an unshifted chord. - pub fn lookup_shifted(&self, key: &str, ctrl: bool, shift: bool) -> Option { self.bindings .iter() - .find(|b| b.chord.ctrl == ctrl && b.chord.shift == shift && b.chord.key == key) + .find(|b| b.chord.ctrl == ctrl && b.chord.key == key) .map(|b| b.action) } @@ -1386,7 +1398,6 @@ mod tests { Chord { key: key.to_string(), ctrl, - shift: false, } } @@ -1402,18 +1413,13 @@ mod tests { fn every_default_stroke_reaches_its_action() { let k = Keymap::defaults(); assert_eq!(k.entries().len(), 71); - // The cut odometer: bare walks one, shift strides ten. + // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+. + // actually type) strides ten. assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext)); assert_eq!(k.lookup(",", false), Some(ActionId::WalkCutPrev)); assert_eq!(k.lookup("/", false), Some(ActionId::LoopTrim)); - assert_eq!( - k.lookup_shifted(".", false, true), - Some(ActionId::WalkCutNext) - ); - assert_eq!( - k.lookup_shifted(",", false, true), - Some(ActionId::WalkCutPrev) - ); + assert_eq!(k.lookup(">", false), Some(ActionId::WalkCutNext10)); + assert_eq!(k.lookup("<", false), Some(ActionId::WalkCutPrev10)); // The trim pair, on its designed bare brackets (DESIGN.md §6). assert_eq!(k.lookup("[", false), Some(ActionId::TrimIn)); assert_eq!(k.lookup("]", false), Some(ActionId::TrimOut)); @@ -1438,14 +1444,8 @@ mod tests { // the sync points a cut has to land on to be copied. assert_eq!(k.lookup("[", true), Some(ActionId::PrevSyncPoint)); assert_eq!(k.lookup("]", true), Some(ActionId::NextSyncPoint)); - assert_eq!( - k.lookup_shifted("]", false, true), - Some(ActionId::SelectNext) - ); - assert_eq!( - k.lookup_shifted("[", false, true), - Some(ActionId::SelectPrev) - ); + assert_eq!(k.lookup("}", false), Some(ActionId::SelectNext)); + assert_eq!(k.lookup("{", false), Some(ActionId::SelectPrev)); assert_eq!(k.lookup("i", false), Some(ActionId::SetIn)); assert_eq!(k.lookup("o", false), Some(ActionId::SetOut)); assert_eq!(k.lookup("u", true), Some(ActionId::ClearRange)); @@ -1460,14 +1460,8 @@ mod tests { assert_eq!(k.lookup("g", true), Some(ActionId::Group)); // The keyboard's way onto a clip, and the pair that walks the lane. assert_eq!(k.lookup("tab", false), Some(ActionId::Select)); - assert_eq!( - k.lookup_shifted("]", false, true), - Some(ActionId::SelectNext) - ); - assert_eq!( - k.lookup_shifted("[", false, true), - Some(ActionId::SelectPrev) - ); + assert_eq!(k.lookup("}", false), Some(ActionId::SelectNext)); + assert_eq!(k.lookup("{", false), Some(ActionId::SelectPrev)); assert_eq!(k.lookup("x", false), Some(ActionId::Delete)); assert_eq!(k.lookup("delete", false), Some(ActionId::Delete)); assert_eq!(k.lookup("l", false), Some(ActionId::Lift)); @@ -1675,16 +1669,20 @@ mod tests { assert_eq!(k.display(ActionId::Undo), "ctrl+z"); assert_eq!(k.lookup("z", false), None); // The action keeps its place in the display order, and the file keeps - // reading in that order too. Deduped, because WalkCutNext/WalkCutPrev - // still carry their own two default chords each (untouched by this - // test's rebinds) and so appear twice running. + // reading in that order too. Deduped only for safety -- both actions + // this test rebinds (Delete and Undo) started with two default + // chords each, but both rebinds above collapse them to one, so no + // action here still appears twice. let mut order: Vec<_> = k.entries().iter().map(|b| b.action).collect(); order.dedup(); assert_eq!(order, ActionId::ALL); assert_eq!(emit(&k), emit(&whole(&emit(&k)))); - // Every action is single-bound except WalkCutNext/WalkCutPrev, still - // two chords each -- one line per action, plus those two extras. - assert_eq!(k.entries().len(), ActionId::ALL.len() + 2); + // With Delete and Undo both collapsed to one chord, every action is + // single-bound: one line each. The stride-10 walk + // (WalkCutNext10/WalkCutPrev10) is its own action now, each bound to + // exactly one literal chord (`>`/`<`), not a second chord on + // WalkCutNext/WalkCutPrev. + assert_eq!(k.entries().len(), ActionId::ALL.len()); } #[test] diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index a07c895..3291c8e 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -129,13 +129,6 @@ struct Player { /// [`should_loop_restart`] with one field instead of asking whether the /// mode is on and then separately what the window is. loop_trim: Option<(u32, u32)>, - /// Whether the stroke [`Player::act`] is running for was held with shift - /// -- the odometer's stride (DESIGN.md §6: bare walks one cut, shift - /// strides ten). Set by the key handler right before `act`, since - /// [`ActionId`] carries no modifier of its own (`.` and `shift+.` are the - /// same [`ActionId::WalkCutNext`], by design -- see keymap.rs's own - /// `bshift`) and nothing else here reads it. - walk_shift: bool, /// Timeline seconds -> frame index, so the clock can be compared to what /// the decoder hands over. fps: f64, @@ -829,7 +822,6 @@ fn main() { loop_on: false, range: None, loop_trim: None, - walk_shift: false, // Full and unmuted, which is what the session it was just // handed is already set to: nothing to push at startup. volume: Volume::default(), diff --git a/crates/app/src/oracle.rs b/crates/app/src/oracle.rs index 77bba5a..b0f9b29 100644 --- a/crates/app/src/oracle.rs +++ b/crates/app/src/oracle.rs @@ -263,6 +263,8 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { // three above it refuse an empty mark. ActionId::WalkCutNext | ActionId::WalkCutPrev + | ActionId::WalkCutNext10 + | ActionId::WalkCutPrev10 | ActionId::TrimIn | ActionId::TrimOut | ActionId::LoopTrim diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index 1b1915b..e4b23d2 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -168,6 +168,8 @@ impl Player { // to read. ActionId::WalkCutNext => self.walk_cut(true, cx), ActionId::WalkCutPrev => self.walk_cut(false, cx), + ActionId::WalkCutNext10 => self.walk_cut_stride(true, 10, cx), + ActionId::WalkCutPrev10 => self.walk_cut_stride(false, 10, cx), // `[` `]` close in on the clip like the brackets they are: `[` // trims a frame off the head, `]` a frame off the tail -- no-aim, // frame detents, clamped to the room the engine already answers @@ -460,11 +462,20 @@ impl Player { } /// The odometer (DESIGN.md §6, `,` `.`): the subject cut steps to its - /// neighbour along its own lane, [`walk_shift`](Player) striding ten - /// instead of one, clamped rather than wrapping at either end - /// ([`walk_cut`]). The playhead follows it there, which is what puts the - /// screen at rest on the new cut for the two-up to draw. + /// neighbour along its own lane, one at a time, clamped rather than + /// wrapping at either end ([`walk_cut`]). The playhead follows it there, + /// which is what puts the screen at rest on the new cut for the two-up + /// to draw. pub(crate) fn walk_cut(&mut self, forward: bool, cx: &mut Context) { + self.walk_cut_stride(forward, 1, cx); + } + + /// [`Player::walk_cut`] with an explicit stride -- ten for + /// [`ActionId::WalkCutNext10`]/[`ActionId::WalkCutPrev10`], its own + /// bound key (DESIGN.md §6's "shift") rather than a modifier read off + /// the bare walk, since gpui never delivers shift alongside `.`/`,` + /// (see [`crate::keymap::Chord`]'s doc). + pub(crate) fn walk_cut_stride(&mut self, forward: bool, stride: usize, cx: &mut Context) { let Some((lane, idx)) = self.selected.anchor() else { return; }; @@ -472,7 +483,6 @@ impl Player { return; }; let clips = session.lane_clips(lane); - let stride = if self.walk_shift { 10 } else { 1 }; let next = walk_cut(idx, clips.len(), forward, stride); let at = clips.get(next).map(|c| f64::from(c.start) / self.fps); self.select((lane, next), cx); @@ -578,7 +588,6 @@ impl Player { let chord = keymap::Chord { key: key.to_string(), ctrl, - shift: false, }; // Only a stroke the file can spell and read back as itself: gpui reports // "+" for shift+=, which is the chord grammar's separator, so binding it diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 9823a6c..fc1816a 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -57,6 +57,40 @@ fn no_colour_is_written_outside_the_theme() { assert!(stray.is_empty(), "colour written outside the theme: {stray:?}"); } +/// The literal-grep above is blind to a hue arriving through a theme +/// *constant*: `DARK_SEAM` carried `rgba(0,0,0,.7)` (`0xRRGGBBAA`) into +/// `rgb()`, which reads the alpha byte as blue -- 2436 blue pixels in a +/// darkroom screenshot, on a call site that never once wrote `0x` itself. +/// So this scan reads the theme's own encoding: every constant whose low +/// byte is not `ff` (i.e. `0xRRGGBBAA` with a real alpha) is alpha-carrying, +/// and an alpha-carrying role may only ever be handed to `rgba(`, never +/// `rgb(`. +#[test] +fn an_alpha_carrying_role_never_reaches_rgb() { + let theme = src_text("ui/theme.rs"); + let alpha_roles: Vec<&str> = theme + .lines() + .filter_map(|l| { + let l = l.trim(); + let l = l.strip_prefix("pub const ")?; + let (name, rest) = l.split_once(':')?; + let hex = rest.trim().strip_prefix("u32 = 0x")?; + let hex = hex.trim_end_matches(';'); + (hex.len() == 8 && !hex.ends_with("ff")).then_some(name.trim()) + }) + .collect(); + assert!(alpha_roles.len() >= 8, "the theme's alpha-carrying roles moved; this scan is blind"); + + let source = ui_source(); + let mut misuses = Vec::new(); + for role in &alpha_roles { + if source.contains(&format!("rgb({role}(")) { + misuses.push(*role); + } + } + assert!(misuses.is_empty(), "alpha-carrying role(s) reaching rgb() instead of rgba(): {misuses:?}"); +} + /// "It scrolls" is not "it can be found": at the 640x360 floor the timeline /// takes its share and no more, so a third track is behind a scroll -- and /// the line that says so has to keep telling the truth *while* the column is diff --git a/crates/app/src/tests/view.rs b/crates/app/src/tests/view.rs index 7a90663..3e95f4e 100644 --- a/crates/app/src/tests/view.rs +++ b/crates/app/src/tests/view.rs @@ -410,7 +410,6 @@ fn no_stroke_is_missing_from_the_keys_menu() { let pretty = keymap::Chord { key: key.to_string(), ctrl: false, - shift: false, } .pretty(); keymap.lookup(key, false).is_some() || keymap::FIXED.iter().any(|f| f.chord == pretty) diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 04e0565..7e2f9f2 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -213,7 +213,6 @@ impl Player { let out = keymap::Chord { key: ESCAPE.to_string(), ctrl: false, - shift: false, } .pretty(); // Every action there is, under its heading, and the strokes the modal diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 906d303..ba70da5 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -69,7 +69,7 @@ fn spine(player: &Player) -> impl IntoElement { .h_full() .bg(rgb(DARK_PANEL())) .border_r_1() - .border_color(rgb(DARK_SEAM())) + .border_color(rgba(DARK_SEAM())) .flex() .flex_col() .items_center() @@ -127,7 +127,7 @@ fn time_band(player: &Player) -> impl IntoElement { .h(px(TIME_BAND_H)) .bg(rgb(DARK_PANEL())) .border_t_1() - .border_color(rgb(DARK_SEAM())) + .border_color(rgba(DARK_SEAM())) .flex() .items_center() .gap(px(16.)) @@ -183,7 +183,7 @@ fn bench() -> impl IntoElement { .rounded(px(0.)) .bg(rgb(DARK_CANVAS())) .border_t_1() - .border_color(rgb(DARK_SEAM())) + .border_color(rgba(DARK_SEAM())) .flex() .items_center() .px(px(12.)) @@ -200,7 +200,7 @@ fn ledger() -> impl IntoElement { .h(px(LEDGER_H)) .bg(rgb(DARK_PANEL())) .border_t_1() - .border_color(rgb(DARK_SEAM())) + .border_color(rgba(DARK_SEAM())) .flex() .items_center() .px(px(12.)) @@ -219,7 +219,7 @@ fn dock(player: &Player, window_h: Pixels, cx: &mut Context) -> impl Int .h_full() .bg(rgb(DARK_PANEL())) .border_l_1() - .border_color(rgb(DARK_SEAM())) + .border_color(rgba(DARK_SEAM())) .flex() .flex_col() .child(dock_stance::render(player, DOCK_W, window_h, cx)) @@ -228,9 +228,7 @@ fn dock(player: &Player, window_h: Pixels, cx: &mut Context) -> impl Int /// The whole stance: spine, screen, time band, bench, ledger, dock, in the /// order DESIGN §5 draws them, over the same key handler the legacy tree /// uses (DESIGN §12 step 3): the darkroom draws its own regions but answers -/// to the one keymap, `shift` threaded through for the odometer's stride -/// ([`Player::walk_shift`]) since [`ActionId`] carries no modifier of its -/// own. +/// to the one keymap. pub(crate) fn render( player: &mut Player, window: &mut Window, @@ -250,8 +248,34 @@ pub(crate) fn render( if this.dismiss_notice() { cx.notify(); } - this.walk_shift = event.keystroke.modifiers.shift; + // Same modal guard the legacy handler's rebinding/keys_open/ + // export_open/exporting/colour/transform/speed/EQ/silence/mix/ + // subtitle-style/menu chain (`render.rs`) amounts to, read as + // one bool instead of re-copied field by field: while a card, a + // rebind capture, or a menu owns the keyboard, the darkroom + // stance yields to it exactly as the legacy tree does. This is + // the fix for the stance's `Home`-inside-the-Colour-card + // misfire. + if this.rebinding.is_some() || this.overlaid() { + // Escape is every card's own way out (`Player::close_card`, + // the same list `overlaid`/`modal` read) -- blocking every + // key while a card is open must not also lock the card open. + if key == ESCAPE { + this.rebinding = None; + this.close_card(); + } + cx.notify(); + return; + } if let Some(action) = this.keymap.lookup(key, ctrl) { + // hook: §12 step 7 -- the keys overlay and the export card + // (and the notice plates that would announce an export's + // progress) have no stance surface yet, so the two actions + // that only ever show up there are suppressed here rather + // than left to open a card nothing on screen can draw. + if matches!(action, ActionId::ShowActions | ActionId::Export) { + return; + } this.act(action, window, cx); } }))