What should an undo/redo mechanism do ?

Bob Sneidar bobs at twft.com
Mon Mar 19 13:43:49 EDT 2012


On Mar 18, 2012, at 5:13 PM, Alex Tweedly wrote:

> 
> The question here is not about how to implement undo/redo (that's relatively straightforward), but rather about the *idea* of undo/redo. I see a few issues that I'd like to hear opinions about :
> 
> 1. the result (if any) of doing a 'save'.
> Should the undo history get wiped when the user saves a document ?
>    (i.e. I can undo back as far as the last save, and no further)
> Or should I be able to undo all the way to the start of this session ?
> Or, indeed, should I store the undo history with the 'save', so that I can undo all the way back to the creation of the document ?

I think it depends on the app. You would not want much of an undo function in an Accounting app for obvious reasons. On the other hand, the benefit of going backwards (and forwards again) in a photo editing or CAD application, even through multiple saves is also obvious. 
> 
> (I have seen each of the above, and can't decide which one I think is better :-)
> 
> 2. Does inserting multiple characters count as a single event for undo-ing ?
> Let's say I click somewhere in a doc, and then type "a" "b" "c"  (i.e. abc)
> If I then undo, should it remove just the 'c', or all 3 chars ('abc') ?
> 
> If you said 'all three', then there's a follow-up question
>   - if I type 'a' 'b'  right-arrow left-arrow 'c'                     (i.e. move the insertion cursor, but bring it back again)
> does that make it into two separate insertion events, or still just one ?

I think that a single undo for a text field should unto the last complete edit of that field between the openField and the closeField event. More that that would become incredibly tedious and people would not use it. 
> 
> 3. Is the intent to undo user actions, or to undo events that affect a document ?
> 
> For instance, if I type      'a' 'b' "Italics" 'c'  "undo"   should I be left in italic or normal insertion mode ?
> Should a subsequent "undo" then simply change the insertion mode, or should it remove the "ab" ?

Undo should not be confused with Revert To Last Saved. Undo is for most purposes, a save event to save event feature. When things get really out of hand, Revert To Last Saved is what the user should opt for. 
> 
> 4. Should I stop worrying about this and just do any one of the above - users are grateful for any system that let's them undo multiple times and will get used to it :-)

Again, depends on the App. If it's a data entry thing, I typically enter an edit state, where the user can choose to cancel or save his multiple edits. This gives the user a sense of security, knowing that the changes he is making are going to have no effect until he intentionally pushes the Save button, and even then you can confirm the choice. 

> 
> Thanks for any opinions
> -- Alex.

NP. Bob.





More information about the use-livecode mailing list