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

feat: made undo work when importing pattern. #2160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paxcut
Copy link
Contributor

@paxcut paxcut commented Mar 9, 2025

A user complained that they imported a file by accident when they meant to export it and as a result had trouble recovering the changes they were trying to save. Auto-save saved the day but there is no reason for not being able to undo changes after importing a pattern.

In fact, the previous implementation treated importing a pattern as a reset on the editor instance which actually erased all previous undo entries. Importing now is treated as a normal editing operation where the entire file is replaced with the imported pattern.
Since all imports use AddText it was easy to add an undo entry to that function while removing the part where the previous undo records were being deleted.

Care is taken to add the preprocessed version of the imported file to the undo buffer so that unwanted chars don't sneak in. A bug was found in the handling of a tab char as well but hopefully it wont need to be used anymore.

A user complained that they imported a file by accident when they meant to export it and as a result had trouble recovering the changes they were trying to save. Autosave saved the day but there is no reason for not being able to undo changes after importing a pattern. Previously importing a pattern was treated as a reset on the editor instance which actually erased all previous undo entries. Importing now is treated as a normal editing where the entire file is replaced with the imported.
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.

1 participant