From ba80cbf65ea90a2c03f58267c4088c96a6332f99 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 14 Nov 2026 17:06:01 +0000 Subject: [PATCH] panels-w4: review fixes (review-2) --- crates/ui-contract/src/contract/cx/edit.rs | 1 - crates/ui-contract/src/primitives/text_adapter.rs | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/ui-contract/src/contract/cx/edit.rs b/crates/ui-contract/src/contract/cx/edit.rs index a01b1950e..c253a0c62 100644 --- a/crates/ui-contract/src/contract/cx/edit.rs +++ b/crates/ui-contract/src/contract/cx/edit.rs @@ -77,7 +77,6 @@ pub(crate) fn gesture_key(id: Id) -> Id { crate::runtime::memory::sub(id, "edit") } - impl Cx<'_, C> { fn gesture_slot(&mut self) -> &mut Gesture> { let id = gesture_key(self.core.id); diff --git a/crates/ui-contract/src/primitives/text_adapter.rs b/crates/ui-contract/src/primitives/text_adapter.rs index b38c53c5c..c4f40ad92 100644 --- a/crates/ui-contract/src/primitives/text_adapter.rs +++ b/crates/ui-contract/src/primitives/text_adapter.rs @@ -414,6 +414,15 @@ pub(crate) fn run(state: &mut TextState, mut input: AdapterIn<'_>) -> AdapterOut let typing = shown.focused && state.preedit.is_none() && !input.read_only; let at = state.draft.as_deref().filter(|_| typing).map(|text| (text, caret.unwrap_or_else(|| text.chars().count()))); state.completions.refresh(input.options.complete.as_deref(), at); + // An Arrow or Page key on a stepping field (`steps_value`) with an unapplied draft applies the draft in this pass, + // so the step the component takes next starts from the committed value, not from the value before the typing. + let stepped = shown.focused + && !input.read_only + && input.options.steps_value + && !input.options.multiline() + && state.preedit.is_none() + && state.draft.is_some() + && ctx.input(|i| [egui::Key::ArrowUp, egui::Key::ArrowDown, egui::Key::PageUp, egui::Key::PageDown].into_iter().any(|key| i.key_pressed(key))); let submitted = (shown.entered && shown.focused).then(|| held_mods(ctx)).filter(|mods| !input.options.multiline() || (input.options.submits && mods.cmd)); if let Some(mods) = submitted { @@ -424,6 +433,8 @@ pub(crate) fn run(state: &mut TextState, mut input: AdapterIn<'_>) -> AdapterOut } } else if separated { state.end = Some(End::Separator); + } else if stepped && state.end.is_none() { + state.end = Some(End::Separator); } else if shown.lost_focus && !input.held && state.draft.is_some() && state.end.is_none() { state.end = Some(End::Blur); }