fix(field): scissors right-click no longer deletes trace when trace layer hidden - #111
Open
dustenhubbard wants to merge 1 commit into
Open
fix(field): scissors right-click no longer deletes trace when trace layer hidden#111dustenhubbard wants to merge 1 commit into
dustenhubbard wants to merge 1 commit into
Conversation
…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
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.
Scissors picks a trace up by deleting it in
scissorsPress, then recreates it inlineReleasevianewTrace.newTraceis 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.lineReleasenow checks thesection.added_tracesdelta to see whether the replacement actually landed, and restores the original when it did not.autoMergeand 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, andnewTrace. It fails on the four layer-hidden cases without the fix. The repo has notests/directory, so this adds one.Closes #51