Cannot be implemented: Feature request: Undo & Redo after save

Wishlists for new functionality and features.
Locked
kolosov
Posts: 1
Joined: 19 Jul 2021 20:59

Cannot be implemented: Feature request: Undo & Redo after save

Post by kolosov »

Hi,

I want to thank for such a great hex editor which I use very often and propose an enhancement. It would be great to have Undo and Redo functions! Right now we only have the Undo function and it only works until we save the opened file. After that, it resets and starts to accumulate the undo history from scratch. These are basic functions - would be nice to have them!

Thanks
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Feature request: Full Undo & Redo!

Post by Maël »

After the file is saved undo cannot be applied anymore, since the diff info is tied to the unmodified file.
This is a consequence of the large file support.
kolosov2
Posts: 1
Joined: 22 Jul 2021 11:03

Re: Cannot be implemented: Feature request: Full Undo & Redo!

Post by kolosov2 »

That's very strange. I use 010 Editor* to edit >4 Gb binary files and they have full Undo & Redo functionality that never resets after a file save. It never consumes >30 Mb RAM or creates any temp files which I would notice due to big file sizes. Why is this a problem for you?

* - I use 5.0.2 version of 010 Editor on Win7, which is not the last version. It can be downloaded from their Previous Versions page.
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Cannot be implemented: Feature request: Undo & Redo after save

Post by Maël »

It's not a problem "for me" and not strange!

The question comes up frequently, which is why my reply was short.

You have only a few options to ensure file consistency: Lock the file, make a copy, or use Windows transactional filesystem services (e.g., used for shadow copy). The latter is not always enabled, though.
Undo (Redo) after save only works reliably if you do one of the above.

Some programs will just rely on no other program modifying the file, and either inform you that this happened and that data consistency may be affected, or simply ignore this fact and apply a now outdated difference information (i.e., create an inconsistent file).

Unless something changed in recent Windows versions, you can only detect if a file was changed, not what part was changed, or if there was an insertion or deletion. In other words: once the file was changed externally, you essentially have to discard the difference information (you can even do a formal proof for that).

Regarding the undo after save: You could keep the file locked, and adapt the history, so you could undo the modified file. This would work since HxD itself modified the file, so the changes are clear. However most people want the file to be unlocked after saving so it can be used in other programs again.

It's a compromise. HxD focuses on data consistency, while unlocking the file as early as possible (and creates backup files). Others might choose comfort over consistency.
kolosov3
Posts: 1
Joined: 23 Jul 2021 22:12

Re: Cannot be implemented: Feature request: Undo & Redo after save

Post by kolosov3 »

If the file is changed by an external program, and you apply the undo function to that file due to the user's will, the user takes full responsibility for the result - not you.
Maël
Site Admin
Posts: 1366
Joined: 12 Mar 2005 14:15

Re: Cannot be implemented: Feature request: Undo & Redo after save

Post by Maël »

Sorry, not if it can cause all kinds of random bugs. The support burden will be on me.
Locked