Skip to content

fix: single undo restores deleted shape#1932

Merged
wkentaro merged 1 commit intomainfrom
fix/delete-shape-double-undo
Apr 8, 2026
Merged

fix: single undo restores deleted shape#1932
wkentaro merged 1 commit intomainfrom
fix/delete-shape-double-undo

Conversation

@wkentaro
Copy link
Copy Markdown
Owner

@wkentaro wkentaro commented Apr 8, 2026

Summary

  • Disconnect itemDropped signal in remLabels to prevent spurious labelOrderChangedloadShapesstoreShapes creating a duplicate undo entry
  • Add e2e test for delete + undo workflow

Why

Deleting a shape required two undos instead of one. removeRows unconditionally emits itemDropped (meant for drag-and-drop reorder), which triggered labelOrderChanged during programmatic removal, creating a duplicate backup in the undo stack.

Test plan

  • test_delete_undo_shape — single undo restores shape count and label identity
  • test_select_shape, test_delete_shape — existing tests still pass
  • Full suite: 86 passed
  • Coverage: canvas.py 64→65%, total 1296→1287 missed lines

@wkentaro wkentaro added the fix label Apr 8, 2026
@wkentaro wkentaro self-assigned this Apr 8, 2026
@wkentaro wkentaro added the fix label Apr 8, 2026
@wkentaro wkentaro added this to the v6.1.0 milestone Apr 8, 2026
remLabels triggered labelOrderChanged via itemDropped signal during
programmatic removal, creating a duplicate undo stack entry. Disconnect
the signal during removal, matching the existing pattern in
shapeSelectionChanged and _load_shapes.
@wkentaro wkentaro force-pushed the fix/delete-shape-double-undo branch from 09a67f2 to 90f6916 Compare April 8, 2026 14:03
@wkentaro wkentaro merged commit bf1cad5 into main Apr 8, 2026
5 checks passed
@wkentaro wkentaro deleted the fix/delete-shape-double-undo branch April 8, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant