Text tab answers the dock filter
Browse files at this commit75f3f17364b31020a79e1761da64de98cc6457a9Parent: a7683f5- fix
- Text tab answers the dock filter
- guards pin the new menu and escape rules
3 changed files +55 -10
- crates/app/src/tests/cards.rs +11 -1
- crates/app/src/tests/layout.rs +27 -8
- crates/app/src/ui/dock_stance.rs +17 -1
crates/app/src/tests/cards.rsmodified+11 -1
| @@ -31,7 +31,17 @@ fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() { | |||
| 31 | let guard_at = stance | 31 | let guard_at = stance |
| 32 | .find("if this.card_open()\n || this.context_menu.is_some()") | 32 | .find("if this.card_open()\n || this.context_menu.is_some()") |
| 33 | .expect("the stance's modal guard"); | 33 | .expect("the stance's modal guard"); |
| 34 | - let guard = &stance[guard_at..guard_at + 1600]; | 34 | + // Wide enough to span the whole guard block -- escape's |
| 35 | + // `escape_closes_overlay` branch and its commentary sit above the | ||
| 36 | + // any-key clears, and a scan window that ends before them read as the | ||
| 37 | + // clears having been deleted (2026-08-27). | ||
| 38 | + let guard = &stance[guard_at..guard_at + 3000]; | ||
| 39 | + assert!( | ||
| 40 | + guard.contains("escape_closes_overlay"), | ||
| 41 | + "the modal guard's escape branch no longer routes through \ | ||
| 42 | + Player::escape_closes_overlay -- the focus rings' own escape \ | ||
| 43 | + branches call that same door, and the two must not diverge" | ||
| 44 | + ); | ||
| 35 | for field in [ | 45 | for field in [ |
| 36 | "this.context_menu = None", | 46 | "this.context_menu = None", |
| 37 | "this.library_menu = None", | 47 | "this.library_menu = None", |
crates/app/src/tests/layout.rsmodified+27 -8
| @@ -2213,18 +2213,25 @@ fn the_darkroom_path_never_lets_a_notice_surface_reach_the_picture() { | |||
| 2213 | 2213 | ||
| 2214 | /// DESIGN §5/§11 check 6, the fourth occlusion defect (notice bar, export | 2214 | /// DESIGN §5/§11 check 6, the fourth occlusion defect (notice bar, export |
| 2215 | /// card, preview badge, now menus): every floating menu that can open above | 2215 | /// card, preview badge, now menus): every floating menu that can open above |
| 2216 | -/// the picture -- the clip context menu, the picker, the library menu -- must | 2216 | +/// the picture -- the clip context menu, the picker -- must size its |
| 2217 | -/// size its scrolling list against `stance::menu_floor`'s room, not the raw | 2217 | +/// scrolling list against `stance::menu_floor`'s room, not the raw window. |
| 2218 | -/// window. Sizing against the whole viewport is exactly the bug that shipped: | 2218 | +/// Sizing against the whole viewport is exactly the bug that shipped: a menu |
| 2219 | -/// a menu taller than the bench/ledger/dock footprint got clamped by | 2219 | +/// taller than the bench/ledger/dock footprint got clamped by `menu_at`'s |
| 2220 | -/// `menu_at`'s own bottom-edge fit back up over the picture, because nothing | 2220 | +/// own bottom-edge fit back up over the picture, because nothing had told |
| 2221 | -/// had told the list it only had the footprint to grow into. This pins the | 2221 | +/// the list it only had the footprint to grow into. This pins the general |
| 2222 | -/// general rule so the next surface someone floats -- a fourth menu, a fifth | 2222 | +/// rule so the next surface someone floats -- a fourth menu, a fifth |
| 2223 | /// occlusion -- cannot silently reintroduce `menu_rows_h(rows.len(), | 2223 | /// occlusion -- cannot silently reintroduce `menu_rows_h(rows.len(), |
| 2224 | /// viewport)` in its place. | 2224 | /// viewport)` in its place. |
| 2225 | +/// | ||
| 2226 | +/// The library menu is the deliberate exception (user 2026-08-27, "right | ||
| 2227 | +/// clicking a library media opens a menu in somewhere nonsense"): it anchors | ||
| 2228 | +/// to a pointer that is always inside the dock, where no picture exists to | ||
| 2229 | +/// protect, and `menu_floor`'s clamp teleported it down to the picture floor | ||
| 2230 | +/// -- so `ui/library.rs` must open at the pointer through `menu_at` alone, | ||
| 2231 | +/// and this guard pins that it never routes back through `menu_floor`. | ||
| 2225 | #[test] | 2232 | #[test] |
| 2226 | fn every_darkroom_menu_sizes_its_list_against_the_floor_room_not_the_raw_viewport() { | 2233 | fn every_darkroom_menu_sizes_its_list_against_the_floor_room_not_the_raw_viewport() { |
| 2227 | - for file in ["ui/overlays.rs", "ui/library.rs"] { | 2234 | + for file in ["ui/overlays.rs"] { |
| 2228 | let text = src_text(file); | 2235 | let text = src_text(file); |
| 2229 | assert!( | 2236 | assert!( |
| 2230 | !text.contains("menu_rows_h(rows.len(), viewport)"), | 2237 | !text.contains("menu_rows_h(rows.len(), viewport)"), |
| @@ -2245,6 +2252,18 @@ fn every_darkroom_menu_sizes_its_list_against_the_floor_room_not_the_raw_viewpor | |||
| 2245 | "{file} no longer opens any menu -- update this guard" | 2252 | "{file} no longer opens any menu -- update this guard" |
| 2246 | ); | 2253 | ); |
| 2247 | } | 2254 | } |
| 2255 | + let library = src_text("ui/library.rs"); | ||
| 2256 | + assert!( | ||
| 2257 | + !library.contains("menu_floor("), | ||
| 2258 | + "ui/library.rs routes its menu through menu_floor's picture-floor \ | ||
| 2259 | + clamp again -- a right-click high in the dock teleports back down \ | ||
| 2260 | + to the picture floor (the 'menu in somewhere nonsense' defect)" | ||
| 2261 | + ); | ||
| 2262 | + assert!( | ||
| 2263 | + library.contains("menu_at(menu.at, viewport"), | ||
| 2264 | + "ui/library.rs no longer anchors its menu to the pointer through \ | ||
| 2265 | + menu_at -- update this guard" | ||
| 2266 | + ); | ||
| 2248 | } | 2267 | } |
| 2249 | 2268 | ||
| 2250 | /// The settings page's own organising rule: PROJECT rows open only the | 2269 | /// The settings page's own organising rule: PROJECT rows open only the |
crates/app/src/ui/dock_stance.rsmodified+17 -1
| @@ -626,10 +626,26 @@ fn source_row( | |||
| 626 | /// dialect from Media/Audio. Hands back the track count for the tab header's | 626 | /// dialect from Media/Audio. Hands back the track count for the tab header's |
| 627 | /// own count line, same as `rows.len()` does for the other two tabs. | 627 | /// own count line, same as `rows.len()` does for the other two tabs. |
| 628 | fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<AnyElement>) { | 628 | fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<AnyElement>) { |
| 629 | - let groups = match player.session.as_ref() { | 629 | + let mut groups = match player.session.as_ref() { |
| 630 | Some(session) => subtitle_rows(session.subtitles()), | 630 | Some(session) => subtitle_rows(session.subtitles()), |
| 631 | None => Vec::new(), | 631 | None => Vec::new(), |
| 632 | }; | 632 | }; |
| 633 | + // The same search box the other two tabs answer to -- a visible filter | ||
| 634 | + // that a whole tab ignored would be a dead control. It matches a track's | ||
| 635 | + // label or its file's name; a group with no surviving track leaves with | ||
| 636 | + // its rows. | ||
| 637 | + let filter = player.dock_filter.to_lowercase(); | ||
| 638 | + if !filter.is_empty() { | ||
| 639 | + for group in &mut groups { | ||
| 640 | + if group.name.to_lowercase().contains(&filter) { | ||
| 641 | + continue; | ||
| 642 | + } | ||
| 643 | + group | ||
| 644 | + .rows | ||
| 645 | + .retain(|row| row.label.to_lowercase().contains(&filter)); | ||
| 646 | + } | ||
| 647 | + groups.retain(|group| !group.rows.is_empty()); | ||
| 648 | + } | ||
| 633 | // Which lane(s) actually hold each track's captions right now -- the | 649 | // Which lane(s) actually hold each track's captions right now -- the |
| 634 | // row's second line answers "is it showing?", so it has to read the | 650 | // row's second line answers "is it showing?", so it has to read the |
| 635 | // timeline, not stay the literal "not placed" it was born saying (the | 651 | // timeline, not stay the literal "not placed" it was born saying (the |