bug: undo merges two unrelated edits made within 350 ms #15
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
linux
packaging
performance
question
tech-debt
ui
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ben/openDither#15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version: 0.1.2 (
main@41c7fc5)System: any.
Steps to reproduce
Ctrl+Zonce.What should have happened
One
Ctrl+Zper edit: the brightness change is reverted, the contrast change stays.What happened instead
Both edits come back with a single undo — verified through the real frame loop with two edits 28 ms apart: after one
Ctrl+Zthe parameters are back at the state from before the first edit. Two unrelated controls, two separate gestures, one undo step.Where it is
The frame hook coalesces history by wall-clock time, not by gesture (
main.rs:3099):The 0.35 s window was added so one slider drag becomes one step, which is right. It also swallows any other edit that happens inside the window — and 0.35 s is a long time when the second edit is a click on a different control.
Suggested fix
Coalesce by identity rather than by time: remember what was edited (the control id, or the field) and how the pointer is doing (a drag is one step from press to release; a click is a step on its own). Then two different controls never merge, and one drag still never produces sixty steps. A simple version: a step is pushed when the edited control changes, or when the pointer is released, whichever comes first.
A check that would catch it
An
--uitestrow: two edits on two different controls a few frames apart, oneCtrl+Z, assert only the second is undone. The current behaviour fails it (verified with a throwaway probe:(100.0, 100.0) -> contrast 150, brightness 40 -> one undo -> (100.0, 100.0)).