Skip to content

Fix Alt-drag duplicate cleanup on right-click abort#3782

Draft
jsjgdh wants to merge 8 commits intoGraphiteEditor:masterfrom
jsjgdh:Alt-Fix
Draft

Fix Alt-drag duplicate cleanup on right-click abort#3782
jsjgdh wants to merge 8 commits intoGraphiteEditor:masterfrom
jsjgdh:Alt-Fix

Conversation

@jsjgdh
Copy link
Contributor

@jsjgdh jsjgdh commented Feb 17, 2026

@jsjgdh jsjgdh marked this pull request as draft February 17, 2026 23:16
@Keavon
Copy link
Member

Keavon commented Feb 17, 2026

/gemini review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to ensure Alt-drag node duplication is cleaned up correctly when the drag is aborted (notably via right-click), by tracking whether duplication occurred during the drag and adjusting transaction handling.

Changes:

  • Introduces a duplicated_in_drag flag to track Alt-drag duplication state across drag lifecycle.
  • Splits duplication into a regular path vs. an Alt-drag path (DuplicateSelectedNodesForDrag) via a shared helper implementation.
  • Adjusts abort/commit behavior on right-click/Escape/PointerUp to try to undo or finalize Alt-drag duplication.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs Adds duplicated_in_drag, introduces DuplicateSelectedNodesForDrag, and changes duplication + drag abort/commit behavior
editor/src/messages/portfolio/document/node_graph/node_graph_message.rs Adds the DuplicateSelectedNodesForDrag message variant
editor/src/messages/portfolio/document/document_message_handler.rs Changes Escape handling to attempt undoing Alt-drag duplication on abort

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with cleaning up duplicated nodes when an Alt-drag operation is aborted. The changes introduce a duplicated_in_drag flag to track when a duplication has occurred during a drag, and uses this flag to ensure proper cleanup via transaction abortion and undos. The logic has been updated for both Escape key and right-click aborts. A good refactoring was done to extract the node duplication logic into a shared duplicate_selected_nodes_impl function.

I have one suggestion to improve code clarity by removing a redundant if/else block. Overall, the changes look good and correctly solve the issue.

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.

2 participants

Comments