fix undo/redo API

now all functions always automatically do the right thing with respect
to undo. All actions are undo. If an undo is to be aborted with Escape
(todo: implement), just tell the undo manager to go back to the wanted
index and throw away the redo history.