Page 1 of 1
Fixed: HxD: Problems with undo and fill/insert
Posted: 20 May 2007 20:53
Hi, I've noticed a few bugs related to those. They also happen in the german developer version.
First, you can't undo "Edit-> Fill selection". I believe the operation is not being added to the undo queue (or something like that); if you edit a few bytes, then fill, then undo the program will undo the edited bytes but the filled ones are still there (in red to show they were modified).
Also, insert is a bit erratic when you insert while selecting something, and more if you also undo. For example if you select highlight 0x20 bytes (other than the first 20) and add 0x100 then undo HxD will undo the addition but not the changed bytes, and sometimes it doesn't add from the cursor (depending on where you selected) or adds extra stuff (in red). After undoing the program believes nothing was changed even (wrong) red zones were added, but if you change something and save the wrong parts are saved too. It's a bit hard to explain but easy to test.
Re: Problems with undo and fill/insert
Posted: 22 May 2007 14:14
lordcanty wrote:First, you can't undo "Edit-> Fill selection". I believe the operation is not being added to the undo queue
Yep, that's correct. I forgot to include this into undo.
lordcanty wrote:For example if you select highlight 0x20 bytes [...]
What is "select highlight"?
lordcanty wrote:sometimes it doesn't add from the cursor (depending on where you selected) or adds extra stuff (in red).
What does that sentence mean?
Re: Problems with undo and fill/insert
Posted: 22 May 2007 22:30
Maël wrote:What is "select highlight"?
Ah, I meant to put either select or hightlight. So "select" a block of length 20.
Maël wrote:What does that sentence mean?
Well... it's a bit hard to explain, you should try it yourself. Just select block, insert and undo a few times in diferent places in a file, you'll see what I mean.
Posted: 23 May 2007 03:22
Could you please detail the process a little more. Just a step by step description would help, ideally a minimal example that triggers the bug.
Something like: I started with an unmodified file, then selected 0x100 bytes, the inserted "abcd" at offset 0x123, then pressed Ctrl+Z, etc.
But first of all: Are you in insert mode when you do this or not (can be changed per INSERT-key). Then, is the file already modified before you add those 0x100 bytes or not and how do you add them (clipboard, entering by keyboard, "Edit|Insert bytes"-function, ...)
Posted: 23 May 2007 23:55
Crap, I forgot to mention I was using "Edit-> Insert bytes...", so when I say insert I mean insert using that option. Sorry I wasn't clear enough, inserting from the keyboard, clipboard and such works fine. Just in case here is a few of examples, using a file all FF'd (but any file will work) of 0x1000 bytes. The insert mode on/off doesn't affect the tests, and I insert all 00s using "Edit-> Insert".
- Put the cursor anywhere, "insert bytes": works perfectly, the program inserts starting from the cursor position. Undoes correctly
- Select the first 0x100 bytes, insert 0x50: works and undoes fine, inserts from the selected block's beginning (0x0) and leaves the selected block untouched.
- Select the first 0x100 bytes, insert 0x100: sometimes inserts and undoes ok, but other times it puts in red the part selected or other random 0x100 B, even after undoing. Sometimes of changes the selected part to other bytes (mostly 0's and a few other bytes). This is a bit random but by undoing and redoing it a few times it should trigger. It also works if you do this in any place of the file with slightly different results.
- At 0x100 select 0x100 bytes (so it's 0x100-0x1FF), insert 0x50: 0x50 bytes are added, but affect the selected part in a weird way. It shows at 0x50 something like "0x50 bytes in red with 0's and random bytes" + "0x50 bytes normal" + "0x50 bytes in red all 0's". If you undo, the last 0x50 bytes are deleted, but the first 0x50 remain, in red. BUT the HxD will think after undoing no changes were made. If you modify somewhere, save and reopen the weird first 0x50 bytes are saved (hard to explain..).
- At 0x100 select 0x100 bytes (so it's 0x100-0x1FF), insert 0x150: the selected part is 0'd + random bytes and now is in red, though the inserted 150 bytes are correct. Undoing only deletes the inserted 150 bytes.
I did these tests without modifying the file, but if you do before the test then undo the results can be weirder, such as other parts somewhere else in the file being changed.
There are even more cases but they are all similar. Basically the idea is: select something, edit->insert, weird things happen depending what you selected (it can be a bit random), undo only undoes insertions but not the bizarre changes. Hope I was clear this time.
I'm not sure how it is supposed to work though. When you insert from the clipboard when selecting something the selected part is deleted, so I'd think "insert bytes" would do the same, but seems it tries to insert from the cursor.
Posted: 25 May 2007 01:19
Thanks for the detailed report!
I'll look into fixing this.
Posted: 08 Jun 2007 23:39
Fixed in version 1.7.1 beta