fix(field): record an undo state for the focus-mode trace split - #131
Open
dustenhubbard wants to merge 1 commit into
Open
fix(field): record an undo state for the focus-mode trace split#131dustenhubbard wants to merge 1 commit into
dustenhubbard wants to merge 1 commit into
Conversation
Shift-clicking a trace of the focused object in Focus mode renames it out of that object and into a new `<obj>_split` contour, via `section.editTraceAttributes`. That branch of `pointerRelease` was the only `editTraceAttributes` caller in the GUI that neither carries `@field_interaction` nor calls `saveState()` itself -- it only called `generateView()`. Its sibling branch three lines below (the "incorporate into obj" merge, through `pasteAttributes`) is decorated and does save. Because no state was pushed, `SectionStates.current_state` still held the *previous* edit's modified-contour set, which cannot name `<obj>_split` -- that contour did not exist when the state was written. A later undo therefore restored the trace under its original name while leaving the `<obj>_split` copy untouched, since nothing told it that contour was part of the change. One trace became two: the reported duplication. Saving the state makes the recorded set name both sides of the split, so undo restores the focused object's contour and empties `<obj>_split` through the existing "contour was just created" path in `SectionStates.undoState`. The split is also no longer silently unrecorded, so it now marks the series modified and refreshes the object/trace lists, both of which `saveState` does and the bare `generateView()` did not. Note for anyone reproducing this by hand: it needs two or more prior undo states. With exactly one, `undoState` takes its single-state branch and wholesale-replaces `section.contours` with the baseline, which discards the orphaned contour and hides the bug. Only the multi-state branch, which restores contours one at a time, leaks. Closes #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Focus mode, shift-clicking a trace of the focused object splits it back out under a
_splitname. That split was never recorded as an undo step, so undoing it put the original trace back but left the split copy behind, leaving two traces where there had been one. The split now saves an undo state like every other trace edit, so undo clears both sides.Closes #99.