Use transactions for adding to the undo manager’s stack

As a consequence of this change, I had to update `Scribe.pushHistory` so that
it will only perform the push if the content has actually changed. This is
because the method is always called after every command is executed, and the
content may not necessarily have changed.