From 6bc7028096a351aa0348bcbf6d76425c5a611103 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Fri, 2 Oct 2026 11:11:16 -0700 Subject: [PATCH] fix: Find on page leaves the query room beside the match count The query field filled what the count and buttons left of the 240-pt box, which was about two letters. Finding now widens the box by 120 into the tab row's spare room, the field keeps at least 72, and the count shortens before the field gives up more. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/main.rs | 13 ++++++++++++- crates/snowbound/src/search.rs | 20 ++++++++++++++++++-- crates/snowbound/tests/replay.rs | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/crates/snowbound/src/main.rs b/crates/snowbound/src/main.rs index e0a3b8fa5a15cc63b45a5da36c2199088df38e95..5aab659e493d1bb8a6f24c17f64e19de201386d9 100644 --- a/crates/snowbound/src/main.rs +++ b/crates/snowbound/src/main.rs @@ -2886,11 +2886,22 @@ impl State { ..Spec::default() }, ); + // Finding widens the box over the tab row's spare room, for the match count beside + // the query. + let wide = if finding { + PAGE_LIST + 120.0 + } else { + PAGE_LIST + }; + let width = ui::Extent { + size: ui::Size::Pixels(wide), + strictness: PAGE_LIST / wide, + }; for folded in [false, true].into_iter().take(if finding { 1 } else { 2 }) { self.ui.open( folded, Spec { - size: [if folded { children() } else { px(PAGE_LIST) }, px(TAB_ROW)], + size: [if folded { children() } else { width }, px(TAB_ROW)], pad: [0.0, (TAB_ROW - ui::shell::TOOL) / 2.0], gap: 3.0, ..Spec::default() diff --git a/crates/snowbound/src/search.rs b/crates/snowbound/src/search.rs index 711e730efd8f1c4c65a0bcc615af76854bcc2c5d..97e813e5fde4f8d7ac0a72f442cbe9607ce5533f 100644 --- a/crates/snowbound/src/search.rs +++ b/crates/snowbound/src/search.rs @@ -1144,7 +1144,15 @@ impl State { self.ui.leaf( "count", Spec { - size: [fit(), px(ui::shell::TOOL)], + // It shortens once the query has given up all it may. + size: [ + ui::Extent { + size: ui::Size::Text, + strictness: 0.5, + }, + px(ui::shell::TOOL), + ], + overflow: ui::Overflow::Ellipsis, inset: [0.0, 3.0, 0.0, 3.0], text: Some(&label), fill: Some(draw::srgb(0xff, 0xe0, 0x5a)), @@ -1177,7 +1185,15 @@ impl State { &mut self.search.query, "", Spec { - size: [fill(), px(ui::shell::TOOL)], + // Wider than the box ever is, so it takes all there is, yet keeps 72 for a + // few words of the query. + size: [ + ui::Extent { + size: ui::Size::Pixels(1000.0), + strictness: 72.0 / 1000.0, + }, + px(ui::shell::TOOL), + ], pad: [4.0, 0.0], role: Some(Role::SearchInput), ..Spec::default() diff --git a/crates/snowbound/tests/replay.rs b/crates/snowbound/tests/replay.rs index 3b4a763783268786a877db12db6ba354fdc9214e..5e19e767a0881677c33a52b734045914410cec8e 100644 --- a/crates/snowbound/tests/replay.rs +++ b/crates/snowbound/tests/replay.rs @@ -369,3 +369,23 @@ fn renaming_a_section_from_its_tab_types_into_the_sidebar_at_once() { "{typed}" ); } + +/// Finding on the page leaves the query room beside the match count: a press just past +/// where the count ends lands in the field. +#[test] +fn the_find_bar_keeps_room_for_the_query() { + let scratch = Scratch::new("find-room"); + let notebook = + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus/cross-container/candidate"); + let mut steps = vec!["modifiers command", "key f", "modifiers", "wait 200"]; + steps.extend(["type Alpha", "wait 400", "move 600 600", "press", "release"]); + steps.extend(["wait 200", "move 1000 52", "press", "release", "wait 200"]); + steps.extend(["type zz", "wait 200", "accessibility found"]); + let [found] = replay(&scratch, Some(¬ebook), &steps) + .try_into() + .unwrap(); + assert!( + found.contains(r#"SearchInput "Find on Page" = "Alphazz" [focused]"#), + "{found}" + ); +} -- 2.54.0