Adding undo and redo.

This involves adding transactional semantics to all commands that modify
data.  This is explicitly *not* optimized right now, but is instead as
simple as possible.  If it proves damaging in the immediate term, we can
easily bound the size of the undo/redo stack.

This builds off the commit that fixes deletion at end of line.