Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undoing pasted items #3075

Merged
merged 2 commits into from
Feb 3, 2024
Merged

Fix undoing pasted items #3075

merged 2 commits into from
Feb 3, 2024

Conversation

amolenaar
Copy link
Member

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

Create elements, copy and paste them, then hit undo. Bang!

Issue Number: fixes #2895

What is the new behavior?

You can safely undo a paste action.

Does this PR introduce a breaking change?

  • Yes
  • No

Deleting items in a diagram behaves different.

Other information

  • Connecting items on a diagram are no longer automatically removed.

* Connected items are no longer unlinked directly
* Connectors are smarter at finding out the diagram

The latter is needed, since a diagram can be set to None before
connections are actually removed from the diagram.
@github-actions github-actions bot added the python Pull requests that update Python code label Feb 3, 2024
Comment on lines -114 to -115
for item in connecting_items:
item.unlink()
Copy link
Member Author

Choose a reason for hiding this comment

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

by removing those lines, connecting items are no longer automatically removed.

However, we shouldn't do this here anyway, since it can interfere with actions performed in when undoing a transaction.

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

Nice fix @amolenaar. I think leaving the relationships is fine because a user can explicitly remove those as well if that's what they are trying to do.

@danyeaw danyeaw added fix A fix for a bug and removed python Pull requests that update Python code labels Feb 3, 2024
@danyeaw danyeaw merged commit 5b26a1e into main Feb 3, 2024
18 checks passed
@danyeaw danyeaw deleted the fix-undo-paste branch February 3, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hypothesis test failed
2 participants