mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-29 00:10:02 -05:00
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.