What should an undo/redo mechanism do ?

Alex Tweedly alex at tweedly.net
Sun Mar 18 20:13:06 EDT 2012


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 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 ?

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" ?

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 :-)

Thanks for any opinions
-- Alex.






More information about the use-livecode mailing list