[Dev] Undo and commit()

John Anderson john at osafoundation.org
Tue Jan 3 13:19:12 PST 2006



Grant Baillie wrote:

> On Jan 3, 2006, at 11:22, John Anderson wrote:
>
>>> Scenario 2: A user manipulates the UI after making an undoable change
>>> A user makes an undoable change, and then clicks on another  
>>> collection. Thanks to CPIA, changes in the UI are also changes in  
>>> the repository. This means that "Undo" operation might actually  
>>> just cause the user to switch back to their preview collection. It  
>>> would take a 2nd Undo operation to actually "undo" the original  
>>> change.
>>
>>
>> I'm not sure I understand this, but if you mean that undo moves the  
>> user interface back to exactly what it was when you did the last  
>> commit, yes that's the way it works and this is what you expect --  
>> undo should get you back to exactly where you were, view included.
>
>
> Hmm... Following this to its logical conclusion, don't we end up  
> having to support undoing things that aren't traditionally undoable,  
> like resizing or moving windows?

Typically you choose commit points at the beginning of  user commands 
that change user data -- for example cut or paste, but not changes to 
the view, like resizing windows. If we have a way to save/restore the 
state of the repository to what it was at those commit points, then 
because the state of the UI is stored in the repository just like the 
state of user items, you naturally end up with a view of the world that 
was the same as it was when you where there. So resizing a wouldn't 
cause a commit point to be saved, but if you did a cut, then resized the 
window, then did an undo, your window would be back to its original size.

>
> --Grant
>
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> Open Source Applications Foundation "Dev" mailing list
> http://lists.osafoundation.org/mailman/listinfo/dev



More information about the Dev mailing list