From 3155a1d3800839ddfd2119d0e30030d7d93d5284 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Wed, 18 Nov 2026 18:43:43 +0000 Subject: [PATCH] Hex field in the colour picker owns Enter; items-virtualisation accepts rows that all lie in the room; drop DIAG prints --- crates/color-ui/src/ui/picker/compact.rs | 5 +++-- crates/color-ui/src/ui/picker_dialog.rs | 8 -------- crates/color-ui/tests/it/picker.rs | 10 ---------- crates/ui-contract/src/testing/suite/collection.rs | 6 ++++++ 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/crates/color-ui/src/ui/picker/compact.rs b/crates/color-ui/src/ui/picker/compact.rs index b084a7a55..736bc9e2c 100644 --- a/crates/color-ui/src/ui/picker/compact.rs +++ b/crates/color-ui/src/ui/picker/compact.rs @@ -124,10 +124,11 @@ impl<'a> Body<'a> { } } - /// The hex field, at `sizing` when given. The Full layout's first show focuses it. + /// The hex field, at `sizing` when given. The Full layout's first show focuses it. Enter in it + /// commits the typed digits and does not reach the dialog's OK, as in the production Colors dialog. pub(super) fn hex_field(&self, ui: &mut Ui, pass: &Pass<'a>, words: &ColorPickerWords, sizing: Option, got: &mut Collected) { let field = - TextField::hex(words.hex.as_str().to_owned(), Bind::given(pass.shows(pass.shown.color.to_rgba()))).empty(pass.shown.color.to_rgba()); + TextField::hex(words.hex.as_str().to_owned(), Bind::given(pass.shows(pass.shown.color.to_rgba()))).empty(pass.shown.color.to_rgba()).submits(); let edit = match sizing { Some(sizing) => field.sizing(sizing), None => field, diff --git a/crates/color-ui/src/ui/picker_dialog.rs b/crates/color-ui/src/ui/picker_dialog.rs index 0efddc297..0216401ea 100644 --- a/crates/color-ui/src/ui/picker_dialog.rs +++ b/crates/color-ui/src/ui/picker_dialog.rs @@ -659,14 +659,6 @@ impl StackDialog for ColorPickerDialog { } }); self.current = held.same().copied(); - if self.layout == ColorPickerDialogLayout::Tabbed { - eprintln!( - "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: held same={} picked={:?} closed={:?}", - self.current.is_some(), - shown.output.picked, - shown.output.closed - ); - } let (picked, closed) = (shown.output.picked, shown.output.closed); let ok = (picked == Some(0) || closed == Some(CloseReason::Enter)) && self.current.is_some(); diff --git a/crates/color-ui/tests/it/picker.rs b/crates/color-ui/tests/it/picker.rs index 6af3d1dc9..aa38193be 100644 --- a/crates/color-ui/tests/it/picker.rs +++ b/crates/color-ui/tests/it/picker.rs @@ -210,17 +210,7 @@ fn the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page() { assert_eq!(dialog_field(&dialogs, "model"), Some(serde_json::json!(RgbModel.id())), "the field names the model shown"); assert!(fixture.by_label("Red").is_some(), "and the compact rows show that model's channels"); - eprintln!( - "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: before typing current={:?} open={}", - dialog_color(&dialogs), - dialogs.borrow().get::().is_some() - ); type_into(&mut fixture, "Hex color", "336699"); - eprintln!( - "DIAG the_tabbed_colors_dialog_opens_on_its_tab_and_answers_from_either_page: after typing current={:?} open={}", - dialog_color(&dialogs), - dialogs.borrow().get::().is_some() - ); assert_eq!(dialog_color(&dialogs).as_deref(), Some("#336699"), "a hex typed on Custom is the colour"); let set = dialogs.borrow_mut().set_json_field(&ctx, id, "tab", serde_json::json!("standard")); diff --git a/crates/ui-contract/src/testing/suite/collection.rs b/crates/ui-contract/src/testing/suite/collection.rs index 04ddacd13..275f31cd9 100644 --- a/crates/ui-contract/src/testing/suite/collection.rs +++ b/crates/ui-contract/src/testing/suite/collection.rs @@ -334,6 +334,12 @@ pub(super) fn long_collection_builds_rows_within_the_room_only(subject: &Subject if ((size.div_ceil(across) - 1) as f32) * row <= room.y { continue; } + // Rows that overlap or differ in length (a honeycomb stacks them at three quarters of a cell, and its rows + // grow and shrink) make the estimate above too long. When every item is built and lies within the room, no + // row is out of view, so nothing was left to skip. + if shown.iter().all(|built| built.rect.max.y <= container.rect.max.y + 0.5) { + continue; + } if shown.len() >= size { return Err(format!("{}: all {size} rows are built though the room holds about {}", story.name, (room.y / row) as usize + 1)); }