Skip to content

Fix pen tool preview line disappearing during undo#4158

Open
Ankitt-02 wants to merge 2 commits into
GraphiteEditor:masterfrom
Ankitt-02:fix-pen-preview-undo
Open

Fix pen tool preview line disappearing during undo#4158
Ankitt-02 wants to merge 2 commits into
GraphiteEditor:masterfrom
Ankitt-02:fix-pen-preview-undo

Conversation

@Ankitt-02
Copy link
Copy Markdown

Summary

Fixes an issue where the Pen tool preview line could disappear after repeatedly undoing while drawing a path.

The undo flow restored anchor history state but did not fully restore the temporary preview/handle continuation state used by the active Pen tool session. This caused the preview segment from the last anchor point to the cursor to stop rendering consistently after multiple undo operations.

Changes

Updated the Pen tool undo handling to restore transient preview-related state during undo operations by refreshing:

  • next_point
  • next_handle_start
  • handle_end

This keeps the preview segment active and consistent while continuing to draw after repeated undo actions.

Testing

Tested by:

  • creating polyline paths
  • repeatedly undoing points
  • continuing path drawing after undo
  • verifying the preview line remains visible and interactive

Closes #3790

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Copy link
Copy Markdown
Contributor

@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 updates the pen tool's undo logic to reset point data when stepping back. The reviewer identified that the assignments to next_point and next_handle_start are redundant because they are immediately overwritten in the subsequent place_anchor call, and suggested only keeping the update to handle_end.

Comment thread editor/src/messages/tool/tool_messages/pen_tool.rs Outdated
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.

Pen tool preview line disappearing during repeated undo

1 participant