Skip to content

Conversation

@thecoolwinter
Copy link
Contributor

Description

Forces the undo manager to start a new undo group after calling startUndoGrouping or endUndoGrouping.

This fixes a case where two groups could accidentally be combined. For instance when dragging text and then dragging it back into the same spot. Previously that operation would result in the following undo grouping:

After first drag:

Group 1:
- {0,8} "" // Removed text

Group 2:
- {0, 0} "DragText" // Inserted text

After dragging back to the original location:

Group 1:
- {0,8} "" // Removed text

Group 2:
- {0, 0} "DragText" // Inserted text
- {0,8} "" // Removed text

Group 3:
- {0, 0} "DragText" // Inserted text

When it should have looked like the following after the second drag back to the original position.

Group 1:
- {0,8} "" // Removed text

Group 2:
- {0, 0} "DragText" // Inserted text

Group 3:
- {0,8} "" // Removed text

Group 4:
- {0, 0} "DragText" // Inserted text

Related Issues

  • N/A

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

N/A

@thecoolwinter thecoolwinter merged commit d5ef35f into CodeEditApp:main Apr 8, 2025
2 checks passed
@thecoolwinter thecoolwinter deleted the fix/undo-break-on-start-group branch April 8, 2025 17:29
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