Undo after save doesn't restore text

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
AlanStewart
Posts: 83
Joined: Fri Jun 02, 2006 6:52 pm

Undo after save doesn't restore text

Post by AlanStewart »

Undo after save doesn't restore text if there are preceeding spaces.

Start with a file that looks like this

Code: Select all

1
If you highlight the 1 (just the character, not the whole line) and hit delete, then save, when you undo, the 1 comes back. This is the expected behaviour.

Next go to a file that looks like this

Code: Select all

 1
Note that there is a single space in front of the 1. Highlight just the 1 character and hit delete, then save, then undo. The undone section is highlighted as if it were being undone, but the text isn't restored.

This appears both in 3.97b and 3.97c. It will work with just about any string.

Thank you,
Alan Stewart
GAIT, BCIT
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Alan,

I'm glad you like the new brace matching feature :)
Undo after save doesn't restore text if there are preceeding spaces.

This is definitely a bug :(

I will take a look at it to see what is going wrong ;)

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Alan,

I had a look into this and in a strange sort of way I think Zeus is working as expected.

The reason you are seeing this behaviour is because you have the "Trim line whitespace on save" option enabled. If you where to uncheck this option then the undo would work exactly as expected ;)

What is happening is after you delete the "1" you are left with a line containing just whitespace.

So after the save, this trim option (which is not undoable) removes the whitespace characters leaving just an empty line.

But now when you try to undo this delete the undo refuses to add the character because the insertion point for the undo is no longer valid (i.e. it will be inserting a character at an index position that is outside the current length of the line) and so it is just ignored.

Hence the reason for this rather strange undo behaviour ;)

Cheers Jussi
Post Reply