authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-02 11:11:16-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-02 12:53:12-07:00
log6bc7028096a351aa0348bcbf6d76425c5a611103
tree53af2f799c55cecfeee4b4b39ca7d95baec32119
parent159858f7ba5bb557db7894c52d7f77d2ff841869
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

3 files changed, 50 insertions(+), 3 deletions(-)

crates/snowbound/src/main.rs+12-1
...@@ -2886,11 +2886,22 @@ impl State {...@@ -2886,11 +2886,22 @@ impl State {
2886 ..Spec::default()2886 ..Spec::default()
2887 },2887 },
2888 );2888 );
2889 // Finding widens the box over the tab row's spare room, for the match count beside
2890 // the query.
2891 let wide = if finding {
2892 PAGE_LIST + 120.0
2893 } else {
2894 PAGE_LIST
2895 };
2896 let width = ui::Extent {
2897 size: ui::Size::Pixels(wide),
2898 strictness: PAGE_LIST / wide,
2899 };
2889 for folded in [false, true].into_iter().take(if finding { 1 } else { 2 }) {2900 for folded in [false, true].into_iter().take(if finding { 1 } else { 2 }) {
2890 self.ui.open(2901 self.ui.open(
2891 folded,2902 folded,
2892 Spec {2903 Spec {
2893 size: [if folded { children() } else { px(PAGE_LIST) }, px(TAB_ROW)],2904 size: [if folded { children() } else { width }, px(TAB_ROW)],
2894 pad: [0.0, (TAB_ROW - ui::shell::TOOL) / 2.0],2905 pad: [0.0, (TAB_ROW - ui::shell::TOOL) / 2.0],
2895 gap: 3.0,2906 gap: 3.0,
2896 ..Spec::default()2907 ..Spec::default()
crates/snowbound/src/search.rs+18-2
...@@ -1144,7 +1144,15 @@ impl State {...@@ -1144,7 +1144,15 @@ impl State {
1144 self.ui.leaf(1144 self.ui.leaf(
1145 "count",1145 "count",
1146 Spec {1146 Spec {
1147 size: [fit(), px(ui::shell::TOOL)],1147 // It shortens once the query has given up all it may.
1148 size: [
1149 ui::Extent {
1150 size: ui::Size::Text,
1151 strictness: 0.5,
1152 },
1153 px(ui::shell::TOOL),
1154 ],
1155 overflow: ui::Overflow::Ellipsis,
1148 inset: [0.0, 3.0, 0.0, 3.0],1156 inset: [0.0, 3.0, 0.0, 3.0],
1149 text: Some(&label),1157 text: Some(&label),
1150 fill: Some(draw::srgb(0xff, 0xe0, 0x5a)),1158 fill: Some(draw::srgb(0xff, 0xe0, 0x5a)),
...@@ -1177,7 +1185,15 @@ impl State {...@@ -1177,7 +1185,15 @@ impl State {
1177 &mut self.search.query,1185 &mut self.search.query,
1178 "",1186 "",
1179 Spec {1187 Spec {
1180 size: [fill(), px(ui::shell::TOOL)],1188 // Wider than the box ever is, so it takes all there is, yet keeps 72 for a
1189 // few words of the query.
1190 size: [
1191 ui::Extent {
1192 size: ui::Size::Pixels(1000.0),
1193 strictness: 72.0 / 1000.0,
1194 },
1195 px(ui::shell::TOOL),
1196 ],
1181 pad: [4.0, 0.0],1197 pad: [4.0, 0.0],
1182 role: Some(Role::SearchInput),1198 role: Some(Role::SearchInput),
1183 ..Spec::default()1199 ..Spec::default()
crates/snowbound/tests/replay.rs+20
...@@ -369,3 +369,23 @@ fn renaming_a_section_from_its_tab_types_into_the_sidebar_at_once() {...@@ -369,3 +369,23 @@ fn renaming_a_section_from_its_tab_types_into_the_sidebar_at_once() {
369 "{typed}"369 "{typed}"
370 );370 );
371}371}
372
373/// Finding on the page leaves the query room beside the match count: a press just past
374/// where the count ends lands in the field.
375#[test]
376fn the_find_bar_keeps_room_for_the_query() {
377 let scratch = Scratch::new("find-room");
378 let notebook =
379 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus/cross-container/candidate");
380 let mut steps = vec!["modifiers command", "key f", "modifiers", "wait 200"];
381 steps.extend(["type Alpha", "wait 400", "move 600 600", "press", "release"]);
382 steps.extend(["wait 200", "move 1000 52", "press", "release", "wait 200"]);
383 steps.extend(["type zz", "wait 200", "accessibility found"]);
384 let [found] = replay(&scratch, Some(&notebook), &steps)
385 .try_into()
386 .unwrap();
387 assert!(
388 found.contains(r#"SearchInput "Find on Page" = "Alphazz" [focused]"#),
389 "{found}"
390 );
391}