wip(keys): dock KEYS tab + single ? — capped mid-work
Browse files at this commitc5971dfa4ef1aa076c1ca5ca1105e219c3ab32ffParent: 388faa69 changed files +208 -238
- DESIGN.md +16 -1
- crates/app/src/main.rs +1 -1
- crates/app/src/player/actions.rs +5 -4
- crates/app/src/player/cards.rs +5 -2
- crates/app/src/tests/cards.rs +3 -5
- crates/app/src/tests/editing.rs +0 -1
- crates/app/src/tests/layout.rs +45 -14
- crates/app/src/ui/dock_stance.rs +96 -7
- crates/app/src/ui/stance.rs +37 -203
DESIGN.mdmodified+16 -1
| @@ -223,7 +223,22 @@ string over ~4 words that instructs rather than reports state is a defect. | |||
| 223 | control it already has no visual presence beside (marks and clipboard on the time band's cut | 223 | control it already has no visual presence beside (marks and clipboard on the time band's cut |
| 224 | readout row; lift/detach/group/regroup as bench lane-head ghosts; fit/resolution/zoom on the | 224 | readout row; lift/detach/group/regroup as bench lane-head ghosts; fit/resolution/zoom on the |
| 225 | screen's own corner; subtitle/silence/project verbs into the dock next to the tab they already | 225 | screen's own corner; subtitle/silence/project verbs into the dock next to the tab they already |
| 226 | - belong to) — at which point the plate deletes and `?` held becomes pure dim, no list. | 226 | + belong to) — at which point the list deletes and `?` becomes pure dim, no list. |
| 227 | + | ||
| 228 | + **Amendment (2026-09-09), explicit per this section's own rule:** the plate is deleted. The | ||
| 229 | + user asked why the spine ended in `?` over `?` and said of the plate it opened "it's not good, | ||
| 230 | + I mean probably location problem" — a surface that appears out of nowhere over the bench, holds | ||
| 231 | + the keyboard, and covers work. The list is now the **dock's third tab, `KEYS`, beside SOURCES | ||
| 232 | + and CLIP**: stable geography, occluding nothing, scrolling like its neighbours, with the same | ||
| 233 | + registry-driven rows (`keys_rows`, section head per `keymap::Category`, label left, mono chord | ||
| 234 | + `ink3` right) and no heading prose, since the tab strip itself is the way back. An action the | ||
| 235 | + room would refuse right now greys to `ink4` like any refused verb (§8) rather than vanishing. | ||
| 236 | + `?` swings the dock to that tab and a second `?` (or `escape`, or a press on another tab) | ||
| 237 | + swings it back — a toggle, not a hold and not a modal: nothing about the KEYS tab owns the | ||
| 238 | + keyboard, so the film keeps playing and every other stroke keeps meaning what the spine says it | ||
| 239 | + means. The spine's `?` glyph wears no chord badge, because its chord *is* its glyph. The | ||
| 240 | + ceiling above is unchanged: the 56 homeless actions still owe a geographic home, and this tab | ||
| 241 | + is what they read from until they get one. | ||
| 227 | 242 | ||
| 228 | ## 10. The joy layer | 243 | ## 10. The joy layer |
| 229 | 244 | ||
crates/app/src/main.rsmodified+1 -1
| @@ -68,7 +68,7 @@ use engine::transform::TransformParams; | |||
| 68 | use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession}; | 68 | use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession}; |
| 69 | use gpui::{ | 69 | use gpui::{ |
| 70 | AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div, | 70 | AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div, |
| 71 | - DragMoveEvent, FocusHandle, KeyDownEvent, KeyUpEvent, MouseButton, MouseDownEvent, | 71 | + DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent, |
| 72 | MouseExitEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, | 72 | MouseExitEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, |
| 73 | ScrollDelta, ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, | 73 | ScrollDelta, ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, |
| 74 | TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, | 74 | TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, |
crates/app/src/player/actions.rsmodified+5 -4
| @@ -257,9 +257,10 @@ impl Player { | |||
| 257 | cx.notify(); | 257 | cx.notify(); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | - /// The actions card, from its key, from the panel button, or from its own | 260 | + /// The keys list, from its key, from the spine's `?`, from the dock's own |
| 261 | - /// row: open, scrolled to the top -- a card that opens where the last | 261 | + /// KEYS tab or from a menu row: the dock swings to that tab, scrolled to |
| 262 | - /// look left it would hide most of the list for a reason nobody remembers. | 262 | + /// the top -- a list that opens where the last look left it would hide |
| 263 | + /// most of itself for a reason nobody remembers. | ||
| 263 | pub(crate) fn show_actions(&mut self, cx: &mut Context<Self>) { | 264 | pub(crate) fn show_actions(&mut self, cx: &mut Context<Self>) { |
| 264 | self.keys_open = true; | 265 | self.keys_open = true; |
| 265 | self.scroll_keys(None); | 266 | self.scroll_keys(None); |
| @@ -445,7 +446,7 @@ impl Player { | |||
| 445 | // below, which otherwise repeats nothing. | 446 | // below, which otherwise repeats nothing. |
| 446 | if self.budget_edit.is_some() { | 447 | if self.budget_edit.is_some() { |
| 447 | Repeat::Card | 448 | Repeat::Card |
| 448 | - } else if self.keys_open || self.export_open || self.exporting().is_some() { | 449 | + } else if self.export_open || self.exporting().is_some() { |
| 449 | Repeat::Nothing | 450 | Repeat::Nothing |
| 450 | } else if self.eq_open.is_some() | 451 | } else if self.eq_open.is_some() |
| 451 | || self.color_open.is_some() | 452 | || self.color_open.is_some() |
crates/app/src/player/cards.rsmodified+5 -2
| @@ -1325,8 +1325,11 @@ impl Player { | |||
| 1325 | /// a keystroke reach `enable()`/`act()` and be answered -- Yes, or a | 1325 | /// a keystroke reach `enable()`/`act()` and be answered -- Yes, or a |
| 1326 | /// spoken `No` -- instead of being swallowed before either is asked. | 1326 | /// spoken `No` -- instead of being swallowed before either is asked. |
| 1327 | pub(crate) fn card_open(&self) -> bool { | 1327 | pub(crate) fn card_open(&self) -> bool { |
| 1328 | - self.keys_open | 1328 | + // Not `keys_open`: since 2026-09-09 that is the dock's KEYS *tab* |
| 1329 | - || self.settings_open | 1329 | + // showing, a region like any other, not a surface sitting on the |
| 1330 | + // keyboard -- every stroke still means what the spine says it means | ||
| 1331 | + // while the list is up. | ||
| 1332 | + self.settings_open | ||
| 1330 | || self.export_open | 1333 | || self.export_open |
| 1331 | || self.eq_open.is_some() | 1334 | || self.eq_open.is_some() |
| 1332 | || self.color_open.is_some() | 1335 | || self.color_open.is_some() |
crates/app/src/tests/cards.rsmodified+3 -5
| @@ -85,15 +85,13 @@ fn every_modal_field_has_a_mounted_surface_somewhere_in_the_darkroom() { | |||
| 85 | ); | 85 | ); |
| 86 | // The mounted-surface function each field's own card draws, by the | 86 | // The mounted-surface function each field's own card draws, by the |
| 87 | // convention the param cards already follow (`x_open` -> `x_card(` -- | 87 | // convention the param cards already follow (`x_open` -> `x_card(` -- |
| 88 | - // `Player::eq_card`/`color_card`/... in `ui/cards.rs`). `keys_open` and | 88 | + // `Player::eq_card`/`color_card`/... in `ui/cards.rs`). |
| 89 | - // `export_open`/`exporting` don't follow that convention (the keys | 89 | + // `export_open`/`exporting` don't follow that convention (export pairs |
| 90 | - // overlay isn't a "card", export pairs with the running-export sheet), | 90 | + // with the running-export sheet), so they're named explicitly. Anything else unmapped panics loudly -- |
| 91 | - // so they're named explicitly. Anything else unmapped panics loudly -- | ||
| 92 | // the point is that a ninth card has to earn a line here, not just a | 91 | // the point is that a ninth card has to earn a line here, not just a |
| 93 | // mount, or this test cannot see it. | 92 | // mount, or this test cannot see it. |
| 94 | let mount_for = |field: &str| -> &'static str { | 93 | let mount_for = |field: &str| -> &'static str { |
| 95 | match field { | 94 | match field { |
| 96 | - "keys_open" => "keys_overlay(", | ||
| 97 | "export_open" => "export_card(", | 95 | "export_open" => "export_card(", |
| 98 | "exporting" => "export_progress_card(", | 96 | "exporting" => "export_progress_card(", |
| 99 | "eq_open" => "eq_card(", | 97 | "eq_open" => "eq_card(", |
crates/app/src/tests/editing.rsmodified+0 -1
| @@ -1367,7 +1367,6 @@ fn every_action_is_reachable_without_the_keyboard() { | |||
| 1367 | #[test] | 1367 | #[test] |
| 1368 | fn every_card_closes_without_the_keyboard() { | 1368 | fn every_card_closes_without_the_keyboard() { |
| 1369 | for card in [ | 1369 | for card in [ |
| 1370 | - "keys_overlay", | ||
| 1371 | "export_card", | 1370 | "export_card", |
| 1372 | "eq_card", | 1371 | "eq_card", |
| 1373 | "color_card", | 1372 | "color_card", |
crates/app/src/tests/layout.rsmodified+45 -14
| @@ -2954,29 +2954,60 @@ fn every_paired_spine_glyph_is_drawn_at_the_narrow_size() { | |||
| 2954 | ); | 2954 | ); |
| 2955 | } | 2955 | } |
| 2956 | 2956 | ||
| 2957 | -/// DESIGN §8 (no instructional copy) and §9: the keys plate's heading is one | 2957 | +/// DESIGN §9 as amended 2026-09-09: the keys list is the dock's third tab, |
| 2958 | -/// noun, its way out is a chord like every other row, and its bottom edge is | 2958 | +/// not a plate over the bench. The overlay the user asked about ("clicking |
| 2959 | -/// inside the window -- the shipped plate said `ALL COMMANDS · HOLD ? · | 2959 | +/// them opens a menu ... probably location problem") is gone with its scrim, |
| 2960 | -/// RELEASE TO CLOSE` while sitting there latched after a click, with its last | 2960 | +/// the tab strip lists all three tabs, and the rows still come off |
| 2961 | -/// rows cut off below y=720. | 2961 | +/// `keys_rows` with the refused ones greyed rather than hidden (§8). |
| 2962 | #[test] | 2962 | #[test] |
| 2963 | -fn the_keys_plate_says_one_noun_and_ends_inside_the_window() { | 2963 | +fn the_keys_list_is_a_dock_tab_and_the_plate_is_gone() { |
| 2964 | - let src = src_text("ui/stance.rs"); | 2964 | + let stance = src_text("ui/stance.rs"); |
| 2965 | - let lower = src.to_lowercase(); | 2965 | + assert!( |
| 2966 | + !stance.contains("keys_overlay") && !stance.contains("stance-keys-overlay"), | ||
| 2967 | + "the keys plate is still mounted over the bench" | ||
| 2968 | + ); | ||
| 2969 | + let dock = src_text("ui/dock_stance.rs"); | ||
| 2970 | + for (id, label) in [ | ||
| 2971 | + ("dock-tab-src", "SOURCES"), | ||
| 2972 | + ("dock-tab-clip", "CLIP"), | ||
| 2973 | + ("dock-tab-keys", "KEYS"), | ||
| 2974 | + ] { | ||
| 2975 | + assert!( | ||
| 2976 | + dock.contains(&format!("dock_tab(\"{id}\", \"{label}\"")), | ||
| 2977 | + "the dock's tab strip lost {label}" | ||
| 2978 | + ); | ||
| 2979 | + } | ||
| 2980 | + assert!( | ||
| 2981 | + dock.contains("fn keys_tab(") && dock.contains("keys_rows()"), | ||
| 2982 | + "the KEYS tab draws something other than the action registry" | ||
| 2983 | + ); | ||
| 2966 | assert!( | 2984 | assert!( |
| 2967 | - !lower.contains("hold ? · release to close") && !lower.contains("all commands"), | 2985 | + dock.contains("Enable::Yes => INK2(),") && dock.contains("_ => INK4(),"), |
| 2968 | - "the keys plate still tells the hand what to do" | 2986 | + "a refused action's row no longer greys to ink4 (DESIGN §8)" |
| 2969 | ); | 2987 | ); |
| 2970 | assert!( | 2988 | assert!( |
| 2971 | - src.contains("section_head(\"keys\")") && src.contains(".child(\"esc\")"), | 2989 | + dock[dock.find("fn keys_tab(").unwrap()..].contains(".overflow_y_scroll()"), |
| 2972 | - "the keys plate lost its noun or its escape chord" | 2990 | + "the KEYS tab does not scroll like its neighbours" |
| 2973 | ); | 2991 | ); |
| 2992 | + // The Sources filter box belongs to Sources: it is built inside | ||
| 2993 | + // `sources_tab`, never in the shared frame `render` draws. | ||
| 2994 | + let frame = &dock[dock.find("pub(crate) fn render(").unwrap()..]; | ||
| 2974 | assert!( | 2995 | assert!( |
| 2975 | - src.contains(".h(px((bench_h + LEDGER_H - 16.).max(0.)))"), | 2996 | + !frame.contains("dock-filter"), |
| 2976 | - "the keys plate is no longer capped inside the bench+ledger footprint" | 2997 | + "the Sources filter box leaked into the shared dock frame" |
| 2977 | ); | 2998 | ); |
| 2978 | } | 2999 | } |
| 2979 | 3000 | ||
| 3001 | +/// The user's screenshot: the spine ended with `?` over `?`. A ghost whose | ||
| 3002 | +/// primary chord IS its glyph wears no badge; every other one still does. | ||
| 3003 | +#[test] | ||
| 3004 | +fn the_spine_question_mark_wears_no_second_question_mark() { | ||
| 3005 | + let src = src_text("ui/stance.rs"); | ||
| 3006 | + assert!( | ||
| 3007 | + src.contains(".when(player.keymap.chord(action) != glyph, |el| {"), | ||
| 3008 | + "the spine ghost draws its chord badge even when the badge repeats the glyph" | ||
| 3009 | + ); | ||
| 3010 | +} | ||
| 2980 | 3011 | ||
| 2981 | /// The ruler's right edge was soup: `bench-select-all` sits `right(4.)` over | 3012 | /// The ruler's right edge was soup: `bench-select-all` sits `right(4.)` over |
| 2982 | /// the tick band while tick suppression only guarded the LEFT plate, so the | 3013 | /// the tick band while tick suppression only guarded the LEFT plate, so the |
crates/app/src/ui/dock_stance.rsmodified+96 -7
| @@ -199,8 +199,15 @@ fn dock_tab( | |||
| 199 | .when(active, |d| d.border_t_1().border_color(rgb(INK1()))) | 199 | .when(active, |d| d.border_t_1().border_color(rgb(INK1()))) |
| 200 | .cursor_pointer() | 200 | .cursor_pointer() |
| 201 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 201 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 202 | - this.dock_src_active = label_text == "SOURCES"; | 202 | + // KEYS is a *look*, not a place the room reopens in: it rides |
| 203 | - save(this.dock_src_active); | 203 | + // `keys_open` and is never written to the dock-tab file, so the |
| 204 | + // pair underneath it (`dock_src_active`) is still what a press on | ||
| 205 | + // KEYS comes back to. | ||
| 206 | + this.keys_open = label_text == "KEYS"; | ||
| 207 | + if !this.keys_open { | ||
| 208 | + this.dock_src_active = label_text == "SOURCES"; | ||
| 209 | + save(this.dock_src_active); | ||
| 210 | + } | ||
| 204 | cx.notify(); | 211 | cx.notify(); |
| 205 | })) | 212 | })) |
| 206 | .children(hitmap::control(id, label_text, true)) | 213 | .children(hitmap::control(id, label_text, true)) |
| @@ -1424,6 +1431,85 @@ fn clip_tab( | |||
| 1424 | ) | 1431 | ) |
| 1425 | } | 1432 | } |
| 1426 | 1433 | ||
| 1434 | +/// The KEYS tab (DESIGN §9, amended 2026-09-09): every bound command, | ||
| 1435 | +/// sectioned by [`keymap::Category`] exactly as [`keys_rows`] files them -- | ||
| 1436 | +/// reusing that registry-driven order is what makes an action added anywhere | ||
| 1437 | +/// land here without a second list to forget. It lives in the dock beside | ||
| 1438 | +/// SOURCES and CLIP rather than on a plate over the bench: stable geography, | ||
| 1439 | +/// occludes nothing, scrolls like its neighbours, and the tab strip itself is | ||
| 1440 | +/// the way back, so there is no heading prose and no `esc` hint to write. | ||
| 1441 | +/// | ||
| 1442 | +/// An action the room would refuse right now greys to `ink4`, the same ink a | ||
| 1443 | +/// refused verb wears (DESIGN §8) -- never hidden: the list is the full truth | ||
| 1444 | +/// about the keyboard, including the strokes that would answer `No` today. | ||
| 1445 | +fn keys_tab(player: &Player) -> impl IntoElement { | ||
| 1446 | + let row_label = label(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | ||
| 1447 | + let row_chord = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | ||
| 1448 | + let pair = move |text: String, chord: String, ink: u32| { | ||
| 1449 | + div() | ||
| 1450 | + .flex_none() | ||
| 1451 | + .flex() | ||
| 1452 | + .justify_between() | ||
| 1453 | + .gap(px(12.)) | ||
| 1454 | + .child( | ||
| 1455 | + div() | ||
| 1456 | + // The label gives way, never the chord: a long parenthetical | ||
| 1457 | + // ("Previous sync point (a cut here is copied...)") pushed | ||
| 1458 | + // the chord column clean off the dock's right edge until | ||
| 1459 | + // this row took `min_w(0)` + ellipsis, the same shape a | ||
| 1460 | + // source row's name already uses. | ||
| 1461 | + .flex_1() | ||
| 1462 | + .min_w(px(0.)) | ||
| 1463 | + .truncate() | ||
| 1464 | + .font(row_label.font.clone()) | ||
| 1465 | + .text_size(row_label.size) | ||
| 1466 | + .text_color(rgb(ink)) | ||
| 1467 | + .child(text), | ||
| 1468 | + ) | ||
| 1469 | + .child( | ||
| 1470 | + div() | ||
| 1471 | + .flex_none() | ||
| 1472 | + .font(row_chord.font.clone()) | ||
| 1473 | + .text_size(row_chord.size) | ||
| 1474 | + .text_color(rgb(if ink == INK4() { INK4() } else { INK3() })) | ||
| 1475 | + .child(chord), | ||
| 1476 | + ) | ||
| 1477 | + .into_any_element() | ||
| 1478 | + }; | ||
| 1479 | + div() | ||
| 1480 | + .id("dock-keys-rows") | ||
| 1481 | + .flex_1() | ||
| 1482 | + .min_h(px(0.)) | ||
| 1483 | + .flex() | ||
| 1484 | + .flex_col() | ||
| 1485 | + .gap(px(3.)) | ||
| 1486 | + .p(px(8.)) | ||
| 1487 | + .overflow_y_scroll() | ||
| 1488 | + .children(keys_rows().into_iter().map(|row| match row { | ||
| 1489 | + KeyRow::Head(category) => div() | ||
| 1490 | + .flex_none() | ||
| 1491 | + .pt(px(4.)) | ||
| 1492 | + .child(section_head(category.label().to_uppercase())) | ||
| 1493 | + .into_any_element(), | ||
| 1494 | + // The full-truth surface: every chord the action answers to | ||
| 1495 | + // (`display`), not the badge's primary-only compact form. | ||
| 1496 | + KeyRow::Act(action) => pair( | ||
| 1497 | + action.label().to_string(), | ||
| 1498 | + player.keymap.display(action), | ||
| 1499 | + match player.enable(action, None) { | ||
| 1500 | + Enable::Yes => INK2(), | ||
| 1501 | + _ => INK4(), | ||
| 1502 | + }, | ||
| 1503 | + ), | ||
| 1504 | + // A fixed stroke is the window's, not an action the room can | ||
| 1505 | + // refuse, so it never greys. | ||
| 1506 | + KeyRow::Fixed(i) => { | ||
| 1507 | + let f = &keymap::FIXED[i]; | ||
| 1508 | + pair(f.label.to_string(), f.chord.to_string(), INK2()) | ||
| 1509 | + } | ||
| 1510 | + })) | ||
| 1511 | +} | ||
| 1512 | + | ||
| 1427 | /// The dock's content, under `stance.rs::dock()`'s tab-bar-and-body frame: | 1513 | /// The dock's content, under `stance.rs::dock()`'s tab-bar-and-body frame: |
| 1428 | /// the tab row, then whichever tab is showing. | 1514 | /// the tab row, then whichever tab is showing. |
| 1429 | /// | 1515 | /// |
| @@ -1442,7 +1528,8 @@ pub(crate) fn render( | |||
| 1442 | window: &mut Window, | 1528 | window: &mut Window, |
| 1443 | cx: &mut Context<Player>, | 1529 | cx: &mut Context<Player>, |
| 1444 | ) -> impl IntoElement { | 1530 | ) -> impl IntoElement { |
| 1445 | - let src_active = player.dock_src_active; | 1531 | + let keys = player.keys_open; |
| 1532 | + let src_active = player.dock_src_active && !keys; | ||
| 1446 | div() | 1533 | div() |
| 1447 | .id("stance-dock-body") | 1534 | .id("stance-dock-body") |
| 1448 | .flex_1() | 1535 | .flex_1() |
| @@ -1459,11 +1546,13 @@ pub(crate) fn render( | |||
| 1459 | .border_b_1() | 1546 | .border_b_1() |
| 1460 | .border_color(rgb(DARK_HAIRLINE())) | 1547 | .border_color(rgb(DARK_HAIRLINE())) |
| 1461 | .child(dock_tab("dock-tab-src", "SOURCES", src_active, cx)) | 1548 | .child(dock_tab("dock-tab-src", "SOURCES", src_active, cx)) |
| 1462 | - .child(dock_tab("dock-tab-clip", "CLIP", !src_active, cx)), | 1549 | + .child(dock_tab("dock-tab-clip", "CLIP", !src_active && !keys, cx)) |
| 1550 | + .child(dock_tab("dock-tab-keys", "KEYS", keys, cx)), | ||
| 1463 | ) | 1551 | ) |
| 1464 | - .child(match src_active { | 1552 | + .child(match (keys, src_active) { |
| 1465 | - true => sources_tab(player, window, cx).into_any_element(), | 1553 | + (true, _) => keys_tab(player).into_any_element(), |
| 1466 | - false => clip_tab(player, width, window_size, window, cx).into_any_element(), | 1554 | + (false, true) => sources_tab(player, window, cx).into_any_element(), |
| 1555 | + (false, false) => clip_tab(player, width, window_size, window, cx).into_any_element(), | ||
| 1467 | }) | 1556 | }) |
| 1468 | } | 1557 | } |
| 1469 | 1558 | ||
crates/app/src/ui/stance.rsmodified+37 -203
| @@ -449,195 +449,32 @@ fn ghost( | |||
| 449 | )) | 449 | )) |
| 450 | .text_color(rgb(INK2())) | 450 | .text_color(rgb(INK2())) |
| 451 | .child(glyph.to_string()) | 451 | .child(glyph.to_string()) |
| 452 | - // Every command wears its chord (DESIGN §4) -- including the one | 452 | + // Every command wears its chord (DESIGN §4) -- except the one whose |
| 453 | - // whose glyph IS its stroke: `?` reads as `?` over a dimmer `?`, | 453 | + // glyph already IS its stroke: `?` over `?` read as two question |
| 454 | - // the same glyph-over-chord anatomy every other spine ghost draws, | 454 | + // marks on the rail and the user asked why ("why two ? exists"). |
| 455 | - // rather than as the one control on the rail with nothing under it. | 455 | + // A badge that only repeats the glyph says nothing, so it is not |
| 456 | - .child( | 456 | + // drawn; every other ghost still wears its chord under it. |
| 457 | - div() | 457 | + .when(player.keymap.chord(action) != glyph, |el| { |
| 458 | - .type_style(type_scale::mono( | 458 | + el.child( |
| 459 | - type_scale::CHORD_METADATA_MIN_PX, | 459 | + div() |
| 460 | - gpui::FontWeight::MEDIUM, | 460 | + .type_style(type_scale::mono( |
| 461 | - )) | 461 | + type_scale::CHORD_METADATA_MIN_PX, |
| 462 | - .text_color(rgb(INK3())) | 462 | + gpui::FontWeight::MEDIUM, |
| 463 | - // FAULT 1: the badge shows the primary chord, compact -- | 463 | + )) |
| 464 | - // same rule as every glyph in `spine_stance`. | 464 | + .text_color(rgb(INK3())) |
| 465 | - .child(player.keymap.chord(action)), | 465 | + // FAULT 1: the badge shows the primary chord, compact -- |
| 466 | - ) | 466 | + // same rule as every glyph in `spine_stance`. |
| 467 | -} | 467 | + .child(player.keymap.chord(action)), |
| 468 | - | 468 | + ) |
| 469 | -/// The keys overlay (DESIGN §9, §12 step 7): every bound command, sectioned | 469 | + }) |
| 470 | -/// by [`keymap::Category`] exactly as the legacy actions card files them | ||
| 471 | -/// ([`keys_rows`]) -- reusing that registry-driven order is what makes an | ||
| 472 | -/// action added anywhere land here without a second list to forget. Held | ||
| 473 | -/// open by `?` -- [`crate::ui::stance::render`]'s own `on_key_down` opens it | ||
| 474 | -/// on the press (bypassing the modal `overlaid()` guard, which would | ||
| 475 | -/// otherwise swallow the second `?` down while the first is still up) and | ||
| 476 | -/// its `on_key_up` closes it on release, so this is the room dimming one | ||
| 477 | -/// fill step for as long as the key is held, never a latch (DESIGN §9: | ||
| 478 | -/// hold-to-peek, click also dismisses). The scrim also closes on a press, | ||
| 479 | -/// same contract every other card's scrim answers, so a hand that lets go | ||
| 480 | -/// of `?` before reading the list still has a door out without touching the | ||
| 481 | -/// keyboard again. | ||
| 482 | -/// | ||
| 483 | -/// corner-cut, named explicitly in DESIGN §9's own 2026-08-20 amendment | ||
| 484 | -/// rather than silently shipped against the section's original text: it | ||
| 485 | -/// wants chords surfaced *in place beside their controls* across every | ||
| 486 | -/// region, and this is one scrolling list plate instead, anchored over the | ||
| 487 | -/// bench/ledger footprint so it never reaches the screen (§11.6 holds). | ||
| 488 | -/// Ceiling: DESIGN §12 step 7's full geographic pass (each region draws its | ||
| 489 | -/// own rows while held) -- §9's amendment names the 56 actions still | ||
| 490 | -/// without a home. | ||
| 491 | -fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 492 | - div() | ||
| 493 | - .id("stance-keys-overlay") | ||
| 494 | - .absolute() | ||
| 495 | - .bottom_0() | ||
| 496 | - .left_0() | ||
| 497 | - .right_0() | ||
| 498 | - // The live `bench_h` the caller already measures for `bench`, | ||
| 499 | - // not the fixed `BENCH_H` default: a hand-dragged | ||
| 500 | - // bench taller than the default left this scrim short of the real | ||
| 501 | - // footprint, so the overlay stopped mid-bench instead of covering it. | ||
| 502 | - .h(px(bench_h + LEDGER_H)) | ||
| 503 | - .bg(rgba(SCRIM())) | ||
| 504 | - .flex() | ||
| 505 | - // The plate's inset lives on the scrim, not on the plate's own | ||
| 506 | - // margins: a margin under a fixed `h()` left the list flush with the | ||
| 507 | - // window's bottom edge and its last rows cut over the ledger. Padding | ||
| 508 | - // here takes the room off the footprint before the plate is measured. | ||
| 509 | - .pl(px(12.)) | ||
| 510 | - .pt(px(8.)) | ||
| 511 | - .pb(px(8.)) | ||
| 512 | - // Bottom-left, not centred: the `?` control that opens this lives at | ||
| 513 | - // the foot of the spine ([`spine`]'s last child), and this overlay | ||
| 514 | - // mounts inside the *centre* column next to it -- anchoring the list | ||
| 515 | - // to this column's own bottom-left edge puts it flush against the | ||
| 516 | - // spine side, beside the control that opened it, instead of adrift | ||
| 517 | - // in the middle of the bench/ledger footprint (user report). | ||
| 518 | - .items_end() | ||
| 519 | - // Click also dismisses (DESIGN §9): the hold-`?`-release above is | ||
| 520 | - // the fast door, this is the same scrim-press-closes contract every | ||
| 521 | - // other card's scrim answers, so a hand that let go of `?` before | ||
| 522 | - // reading the list still has a way to shut it without the keyboard. | ||
| 523 | - .on_mouse_down( | ||
| 524 | - MouseButton::Left, | ||
| 525 | - cx.listener(|this, _: &MouseDownEvent, _, cx| { | ||
| 526 | - this.close_card(); | ||
| 527 | - cx.notify(); | ||
| 528 | - cx.stop_propagation(); | ||
| 529 | - }), | ||
| 530 | - ) | ||
| 531 | - .child( | ||
| 532 | - div() | ||
| 533 | - .id("stance-keys-list") | ||
| 534 | - // Capped to the bench+ledger footprint less the scrim's own | ||
| 535 | - // inset, so the bottom border is on screen and the rows | ||
| 536 | - // scroll inside it (DESIGN §9). | ||
| 537 | - .h(px((bench_h + LEDGER_H - 16.).max(0.))) | ||
| 538 | - .w(px(460.)) | ||
| 539 | - .overflow_y_scroll() | ||
| 540 | - .p(px(10.)) | ||
| 541 | - .rounded(px(4.)) | ||
| 542 | - .bg(rgb(DARK_PANEL())) | ||
| 543 | - .border_1() | ||
| 544 | - .border_color(rgba(DARK_SEAM())) | ||
| 545 | - .on_mouse_down(MouseButton::Left, swallow) | ||
| 546 | - .flex() | ||
| 547 | - .flex_col() | ||
| 548 | - .gap(px(3.)) | ||
| 549 | - // DESIGN §8, no instructional copy: the heading is the | ||
| 550 | - // single noun, and the way out is a chord on the right like | ||
| 551 | - // every other row here -- not a sentence that lied anyway | ||
| 552 | - // (a click-opened plate does not close on a release). | ||
| 553 | - .child( | ||
| 554 | - div() | ||
| 555 | - .flex_none() | ||
| 556 | - .flex() | ||
| 557 | - .justify_between() | ||
| 558 | - .gap(px(12.)) | ||
| 559 | - .child(section_head("keys")) | ||
| 560 | - .child( | ||
| 561 | - div() | ||
| 562 | - .type_style(type_scale::mono( | ||
| 563 | - type_scale::CHORD_METADATA_MIN_PX, | ||
| 564 | - gpui::FontWeight::MEDIUM, | ||
| 565 | - )) | ||
| 566 | - .text_color(rgb(INK3())) | ||
| 567 | - .child("esc"), | ||
| 568 | - ), | ||
| 569 | - ) | ||
| 570 | - .children(keys_rows().into_iter().map(|row| { | ||
| 571 | - match row { | ||
| 572 | - KeyRow::Head(category) => div() | ||
| 573 | - .flex_none() | ||
| 574 | - .pt(px(4.)) | ||
| 575 | - .type_style(type_scale::head()) | ||
| 576 | - .text_color(rgb(INK3())) | ||
| 577 | - .child(category.label().to_uppercase()) | ||
| 578 | - .into_any_element(), | ||
| 579 | - KeyRow::Act(action) => div() | ||
| 580 | - .flex() | ||
| 581 | - .justify_between() | ||
| 582 | - .gap(px(12.)) | ||
| 583 | - .child( | ||
| 584 | - div() | ||
| 585 | - .type_style(type_scale::label( | ||
| 586 | - type_scale::CHORD_METADATA_MIN_PX, | ||
| 587 | - gpui::FontWeight::MEDIUM, | ||
| 588 | - )) | ||
| 589 | - .text_color(rgb(INK2())) | ||
| 590 | - .child(action.label()), | ||
| 591 | - ) | ||
| 592 | - .child( | ||
| 593 | - div() | ||
| 594 | - .type_style(type_scale::mono( | ||
| 595 | - type_scale::CHORD_METADATA_MIN_PX, | ||
| 596 | - gpui::FontWeight::MEDIUM, | ||
| 597 | - )) | ||
| 598 | - .text_color(rgb(INK3())) | ||
| 599 | - // The keys overlay is the full-truth surface | ||
| 600 | - // (FAULT 1): every chord an action answers to, | ||
| 601 | - // not the badge's primary-only compact form. | ||
| 602 | - .child(player.keymap.display(action)), | ||
| 603 | - ) | ||
| 604 | - .into_any_element(), | ||
| 605 | - KeyRow::Fixed(i) => { | ||
| 606 | - let f = &keymap::FIXED[i]; | ||
| 607 | - div() | ||
| 608 | - .flex() | ||
| 609 | - .justify_between() | ||
| 610 | - .gap(px(12.)) | ||
| 611 | - .child( | ||
| 612 | - div() | ||
| 613 | - .type_style(type_scale::label( | ||
| 614 | - type_scale::CHORD_METADATA_MIN_PX, | ||
| 615 | - gpui::FontWeight::MEDIUM, | ||
| 616 | - )) | ||
| 617 | - .text_color(rgb(INK2())) | ||
| 618 | - .child(f.label), | ||
| 619 | - ) | ||
| 620 | - .child( | ||
| 621 | - div() | ||
| 622 | - .type_style(type_scale::mono( | ||
| 623 | - type_scale::CHORD_METADATA_MIN_PX, | ||
| 624 | - gpui::FontWeight::MEDIUM, | ||
| 625 | - )) | ||
| 626 | - .text_color(rgb(INK3())) | ||
| 627 | - .child(f.chord.clone()), | ||
| 628 | - ) | ||
| 629 | - .into_any_element() | ||
| 630 | - } | ||
| 631 | - } | ||
| 632 | - })), | ||
| 633 | - ) | ||
| 634 | } | 470 | } |
| 635 | 471 | ||
| 636 | /// The spine: 56px, left, full height. Frame only -- grouped rows, task | 472 | /// The spine: 56px, left, full height. Frame only -- grouped rows, task |
| 637 | /// frequency, glyph-over-chord grammar and every click all live in | 473 | /// frequency, glyph-over-chord grammar and every click all live in |
| 638 | /// [`crate::ui::spine_stance`] now (MOCK-SPEC.md "Spine"); this fn keeps | 474 | /// [`crate::ui::spine_stance`] now (MOCK-SPEC.md "Spine"); this fn keeps |
| 639 | /// the panel's own surface and the `?` row, which stays part of the frame | 475 | /// the panel's own surface and the `?` row, which stays part of the frame |
| 640 | -/// since it opens [`keys_overlay`] right here rather than through `act`. | 476 | +/// since it swings the dock to its KEYS tab right here rather than through |
| 477 | +/// `act`. | ||
| 641 | fn spine(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | 478 | fn spine(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { |
| 642 | div() | 479 | div() |
| 643 | .id("stance-spine") | 480 | .id("stance-spine") |
| @@ -983,18 +820,28 @@ pub(crate) fn render( | |||
| 983 | Player::discard_sidecar(&sidecar); | 820 | Player::discard_sidecar(&sidecar); |
| 984 | } | 821 | } |
| 985 | } | 822 | } |
| 986 | - // DESIGN §9: "`?` held ... surfaces chords ... release restores. | 823 | + // DESIGN §9 as amended 2026-09-09: `?` swings the dock to its |
| 987 | - // No modal cheat-sheet." Opened here, ahead of the modal guard | 824 | + // KEYS tab and a second `?` swings it back -- no plate, no hold, |
| 988 | - // below (which would otherwise swallow a second `?` down once | 825 | + // no modal cheat-sheet. Asked ahead of the modal guard below so |
| 989 | - // `keys_open` is already true) -- `on_key_up` is the only thing | 826 | + // the stroke is heard whatever else is up, and toggling here |
| 990 | - // that closes it, so there is no latch to fall through to. | 827 | + // rather than latching is what makes the same key the way out. |
| 991 | if key == "?" && !ctrl { | 828 | if key == "?" && !ctrl { |
| 992 | - if !this.keys_open { | 829 | + match this.keys_open { |
| 993 | - this.show_actions(cx); | 830 | + true => this.keys_open = false, |
| 831 | + false => this.show_actions(cx), | ||
| 994 | } | 832 | } |
| 995 | cx.notify(); | 833 | cx.notify(); |
| 996 | return; | 834 | return; |
| 997 | } | 835 | } |
| 836 | + // The other way back to the tab underneath (the tab strip being | ||
| 837 | + // the third): only when no card is up, so escape still shuts a | ||
| 838 | + // card first -- the KEYS tab is a dock tab now, not an overlay, | ||
| 839 | + // and nothing about it owns the keyboard. | ||
| 840 | + if key == "escape" && this.keys_open && !this.card_open() { | ||
| 841 | + this.keys_open = false; | ||
| 842 | + cx.notify(); | ||
| 843 | + return; | ||
| 844 | + } | ||
| 998 | // The dock's Sources filter (MOCK-SPEC "Dock" §2), the same door | 845 | // The dock's Sources filter (MOCK-SPEC "Dock" §2), the same door |
| 999 | // legacy `render.rs` gives it: owns the keyboard only while it | 846 | // legacy `render.rs` gives it: owns the keyboard only while it |
| 1000 | // was clicked into (`dock_stance.rs` sets `dock_filter_edit` on | 847 | // was clicked into (`dock_stance.rs` sets `dock_filter_edit` on |
| @@ -1113,16 +960,6 @@ pub(crate) fn render( | |||
| 1113 | this.act(action, window, cx); | 960 | this.act(action, window, cx); |
| 1114 | } | 961 | } |
| 1115 | })) | 962 | })) |
| 1116 | - // The release half of the `?` hold above: whatever opened it, this is | ||
| 1117 | - // the one thing that closes it -- there is nothing else in the | ||
| 1118 | - // darkroom that sets `keys_open` true, so this cannot close a card | ||
| 1119 | - // `?` did not open. | ||
| 1120 | - .on_key_up(cx.listener(|this, event: &KeyUpEvent, _, cx| { | ||
| 1121 | - if event.keystroke.key.as_str() == "?" { | ||
| 1122 | - this.keys_open = false; | ||
| 1123 | - cx.notify(); | ||
| 1124 | - } | ||
| 1125 | - })) | ||
| 1126 | // The seam drag is tracked on the root, same reason the legacy | 963 | // The seam drag is tracked on the root, same reason the legacy |
| 1127 | // ruler-scrub is (render.rs): the pointer outruns the 6px divider | 964 | // ruler-scrub is (render.rs): the pointer outruns the 6px divider |
| 1128 | // hitbox on the first move, so only the whole-window root keeps | 965 | // hitbox on the first move, so only the whole-window root keeps |
| @@ -1171,9 +1008,6 @@ pub(crate) fn render( | |||
| 1171 | .child(divider(Split::Bench, player.split_drag == Some(Split::Bench), cx)) | 1008 | .child(divider(Split::Bench, player.split_drag == Some(Split::Bench), cx)) |
| 1172 | .child(bench(player, bench_h, window, cx)) | 1009 | .child(bench(player, bench_h, window, cx)) |
| 1173 | .child(ledger(player, position)) | 1010 | .child(ledger(player, position)) |
| 1174 | - .when(player.keys_open, |el| { | ||
| 1175 | - el.child(keys_overlay(player, bench_h, cx)) | ||
| 1176 | - }) | ||
| 1177 | .when(player.settings_open, |el| { | 1011 | .when(player.settings_open, |el| { |
| 1178 | el.child(settings_stance::render(player, window_size, cx)) | 1012 | el.child(settings_stance::render(player, window_size, cx)) |
| 1179 | }) | 1013 | }) |