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 so undoing complex operations in TextEdit will restore selections #86118

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

TheSofox
Copy link
Contributor

Fixes #72769

When doing a complex operation in TextEdit (using begin_complex_operation and end_complex_operation to start and end them), undoing one of these operations should have restored the original text selections, however in some cases (especially with multicarat selections), the selections wouldn't be properly restored.

It seems that there was an effort to code this in before, but it was either not finished or more likely broken by subsequent code changes. This PR fixes this using the existing system.

@TheSofox TheSofox requested a review from a team as a code owner December 13, 2023 13:45
@KoBeWi KoBeWi added this to the 4.3 milestone Dec 13, 2023
Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

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

LGTM.

Nice spot, looks like it was missed out as we set current_op.start_carets; in begin_complex_operation but as it's TextOperation::TYPE_NONE; it gets overwritten by the new op thus we lose the original caret state.

Could you add a unit test to capture this behaviour?

@TheSofox TheSofox force-pushed the complex-undo-select-fix branch from 560c4af to 4b82cac Compare December 20, 2023 00:13
@TheSofox TheSofox requested a review from a team as a code owner December 20, 2023 00:13
@TheSofox
Copy link
Contributor Author

Amended commit with Unit Test. I confirmed it failed on master but passed on this branch. It tests for the exact behaviour that this PR fixes.

@YuriSizov YuriSizov merged commit 02bc2a3 into godotengine:master Dec 20, 2023
@YuriSizov
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undoing TextEdit complex operation doesn't revert all selections
5 participants