Maintain edit history on document reload

This branch adds an support for maintaining the undo history when reloading a document, as well as allowing the reload operation to be reverted. This behavior is controlled by the `keep_edit_history_on_reload` option, which is on by default.

Note that this branch is based off `bug/clear-redo-on-edit` from PR #187