Page 1 of 1

Cannot be done: Undo after save

Posted: 06 Mar 2010 04:34
by valkyr
It'd be nice if undo still worked after saving a file...

Re: Undo after save

Posted: 21 Mar 2010 15:40
by Maël
The big-file support means undo after save cannot be implemented without copying the entire file, which would be slow.

Re: Undo after save

Posted: 22 Mar 2010 11:45
by DVV
Maël wrote:The big-file support means undo after save cannot be implemented without copying the entire file, which would be slow.
Just my thoughts. With planned internal script support, both modification and undo operations could be done by the same script engine:
1. modification -> (script) log <addr1>, <original_value1>; mov <addr1>, <new_value1>; log <addr2>, <original_value2>; mov <addr2>, <new_value2>; ...
2. undo -> (script) mov <addr1>, <original_value1>; mov <addr2>, <original_value2>; ...
The logging (i.e. remembering of the previous values) could be done by the script engine internally.
Such approach assumes all the user operations are first transformed to the internal script commands which are executed then. Of course, this may need architecture re-design of HxD.

Re: Undo after save

Posted: 23 Mar 2010 00:25
by Maël
HxD already keeps a diff of what was added, inserted and deleted in a file. But this diff is only valid as long as the underlying file doesn't change in an unknown way (i.e. is changed by an external program). As soon as a file is saved it's unlocked thereby making it possible for other programs to change it. So undo after save isn't possible, except if you make a temporary copy of the file (which is costly when the file is big).