Refactor UndoRedo, fix initial tooltip state

Fixes #1487.