Skip to content

fix(field): record an undo state for the focus-mode trace split - #131

Open
dustenhubbard wants to merge 1 commit into
SynapseWeb:mainfrom
dustenhubbard:fix/focus-split-undo-duplicate
Open

fix(field): record an undo state for the focus-mode trace split#131
dustenhubbard wants to merge 1 commit into
SynapseWeb:mainfrom
dustenhubbard:fix/focus-split-undo-duplicate

Conversation

@dustenhubbard

@dustenhubbard dustenhubbard commented Aug 7, 2026

Copy link
Copy Markdown
Member

In Focus mode, shift-clicking a trace of the focused object splits it back out under a _split name. 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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trace Duplication from Undoing an Erroneous Merge

1 participant