Skip to content

fix(field): scissors right-click no longer deletes trace when trace layer hidden - #111

Open
dustenhubbard wants to merge 1 commit into
mainfrom
fix/scissors-rightclick-delete
Open

fix(field): scissors right-click no longer deletes trace when trace layer hidden#111
dustenhubbard wants to merge 1 commit into
mainfrom
fix/scissors-rightclick-delete

Conversation

@dustenhubbard

@dustenhubbard dustenhubbard commented Jul 29, 2026

Copy link
Copy Markdown
Member

Scissors picks a trace up by deleting it in scissorsPress, then recreates it in lineRelease via newTrace. newTrace is wrapped by @field_interaction, which is a no-op while the trace layer is hidden. A right-click completion with the layer hidden therefore deleted the trace and put nothing back.

lineRelease now checks the section.added_traces delta to see whether the replacement actually landed, and restores the original when it did not. autoMerge and the log entry gate on the same signal. Knife and merge delete and recreate inside a single guarded method, so they were already safe.

Includes a headless regression test that drives the real scissorsPress, lineRelease, and newTrace. It fails on the four layer-hidden cases without the fix. The repo has no tests/ directory, so this adds one.

Closes #51

…ayer hidden

The scissors tool picks a trace up by DELETING it up front in scissorsPress
(a raw section.deleteTraces call, not guarded by @field_interaction) and relies
on the right-click completion in lineRelease to recreate it via newTrace. But
newTrace is wrapped by @field_interaction, which is a no-op while the trace
layer is hidden. So a scissors pickup followed by a right-click completion with
the trace layer hidden deleted the trace with nothing put back, silently
destroying the user's work.

lineRelease now detects whether newTrace actually added the replacement (via the
section.added_traces delta, since the return value carries log_event which is
forced False while scissoring) and, when it did not, restores the original
picked-up trace instead of leaving it deleted. Also gates autoMerge and the
scissors "Modify trace(s)" log on that same signal so neither fires when no
trace was created.

Sibling tools were checked: knife (cutTrace) and mergeTraces delete and recreate
inside a single @field_interaction method, so they skip atomically when hidden
and never lose data. Only the scissors tool split its delete from its guarded
recreate across two event handlers.

Regression test drives the real scissorsPress + lineRelease + newTrace headless.

Closes #51
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.

Right-click deletes trace when using the scissors tool and all other traces are hidden

1 participant