A typed value equal to the current one is no edit

This commit is contained in:
bflatastic committed 2026-11-02 18:33:39 +07:00
1 parent 366f52b888
commit 1a703ecfaf
2 files changed
+5

No files matched your search

+1
View File
@@ -55,6 +55,7 @@ fn slider_inner(ui: &mut Ui, label: &str, value: &mut f32, range: std::ops::Rang
&& text != shown
&& let Ok(v) = text.trim().parse::<f32>()
&& v.is_finite()
&& v.clamp(lo, hi) != *value
{
*value = v.clamp(lo, hi);
edit = Some(false);
+4
View File
@@ -183,5 +183,9 @@ fn leaving_the_number_field_unchanged_keeps_the_value() {
h.key_press(egui::Key::Escape);
h.run_steps(3);
assert_eq!(opacity(&h, effect), 0.333);
// Typing the value it already has is no edit either.
type_opacity(&mut h, &[egui::Key::End, egui::Key::Backspace, egui::Key::Backspace, egui::Key::Backspace, egui::Key::Backspace], "0.333");
h.key_press(egui::Key::Enter);
h.run_steps(3);
assert_eq!(h.state().session.history_labels().len(), steps);
}