From c09e0a67986d6696e26b5dc9ef8fa58f5fa8c0cb Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 11 Nov 2026 13:24:12 +0000 Subject: [PATCH] Entries a step skips: Entry::stepped, one step rule for Select and ComboBox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A step over a closed control stops on the enabled, stepped entries only. A value on none of them (mixed, or an entry only the open list offers) has no place: it reports no number, so both steps are offered, and a step forward lands on the first stop and a step back on the last. Select and ComboBox step with the shared step_stops and step_stop. LutPicker marks Load 3D LUT…, the folder files and the loaded LUT as not stepped, in place of its filter on step events. The loaded LUT then offers both steps, which the craft-color activation suite asks for. --- crates/color/src/ui/lut_picker.rs | 19 +++--- crates/ui-contract/src/contract/entry.rs | 39 +++++++++++- crates/ui-contract/src/contract/mod.rs | 2 +- crates/ui-widgets/src/pickers/combo_box.rs | 19 ++---- crates/ui-widgets/src/pickers/select.rs | 60 +++++++++---------- crates/ui-widgets/tests/it/pickers/mod.rs | 1 + .../tests/it/pickers/select_steps.rs | 37 ++++++++++++ 7 files changed, 118 insertions(+), 59 deletions(-) create mode 100644 crates/ui-widgets/tests/it/pickers/select_steps.rs diff --git a/crates/color/src/ui/lut_picker.rs b/crates/color/src/ui/lut_picker.rs index 0dade557a..262ec25d7 100644 --- a/crates/color/src/ui/lut_picker.rs +++ b/crates/color/src/ui/lut_picker.rs @@ -171,7 +171,8 @@ fn seconds() -> u64 { /// slow); until a scan ends the list shows the last one. Another folder drops the old list at /// once. Web has no folder. /// - The wheel and the arrow keys over the closed field step through None and the built-ins -/// only (a folder file would be read from disk at each step). +/// only (a folder file would be read from disk at each step). From a folder file or the loaded +/// LUT, a step forward lands on None and a step back on the last built-in. #[derive(craft_ui::contract::Component, craft_ui::contract::Props)] #[component] pub struct LutPicker<'a> { @@ -192,25 +193,26 @@ impl<'a> LutPicker<'a> { } fn entries(words: &LutWords, current: Option<&LutChoice>, files: &FolderFiles) -> Vec> { - let mut entries = vec![Entry::new(Row::Load, words.load.clone()), Entry::new(Row::Choice(LutChoice::None), words.none.clone())]; + let mut entries = + vec![Entry::new(Row::Load, words.load.clone()).stepped(false), Entry::new(Row::Choice(LutChoice::None), words.none.clone())]; for (id, _) in craft_cms::lutfile::BUILTIN { entries.push(Entry::new(Row::Choice(LutChoice::Builtin(id)), builtin_name(words, id))); } let mut listed = false; for (name, path) in files { listed |= matches!(current, Some(LutChoice::Folder(held)) if held == path); - entries.push(Entry::new(Row::Choice(LutChoice::Folder(path.clone())), Label::from(name.clone()))); + entries.push(Entry::new(Row::Choice(LutChoice::Folder(path.clone())), Label::from(name.clone())).stepped(false)); } // The file in use while a scan has not found it yet (or the folder changed under it). if let Some(LutChoice::Folder(path)) = current && !listed { let name = path.file_name().map_or_else(|| path.display().to_string(), |n| n.to_string_lossy().into_owned()); - entries.push(Entry::new(Row::Choice(LutChoice::Folder(path.clone())), Label::from(name))); + entries.push(Entry::new(Row::Choice(LutChoice::Folder(path.clone())), Label::from(name)).stepped(false)); } if let Some(LutChoice::Loaded { name, size }) = current { let text = words.custom.fill(&[("name", name), ("size", &size.to_string())]); - entries.push(Entry::new(Row::Choice(current.cloned().unwrap_or(LutChoice::None)), Label::from(text))); + entries.push(Entry::new(Row::Choice(current.cloned().unwrap_or(LutChoice::None)), Label::from(text)).stepped(false)); } entries } @@ -320,12 +322,7 @@ impl Component for LutPicker<'_> { for event in &out.events { match event.value() { Some(Row::Load) => self.load_asked |= matches!(event, EditEvent::Commit { .. }), - Some(Row::Choice(choice)) => { - let step = matches!(event, EditEvent::Set { .. }); - if !step || matches!(choice, LutChoice::None | LutChoice::Builtin(_)) { - adopted.push(event.clone()); - } - } + Some(Row::Choice(_)) => adopted.push(event.clone()), None => {} } } diff --git a/crates/ui-contract/src/contract/entry.rs b/crates/ui-contract/src/contract/entry.rs index 33c20f201..183356fde 100644 --- a/crates/ui-contract/src/contract/entry.rs +++ b/crates/ui-contract/src/contract/entry.rs @@ -28,12 +28,13 @@ struct Item { enabled: bool, reason: Option