Operation groups & improve undo behaviour

Aim of this patch is to further improve the undo behaviour to bring it slightly more inline with other editors.

Key features
* Styling a bunch of paragraphs (e.g., mass indent) is undone in a single step (previously it took 2 undo steps to unindent each paragraph)
* A word that was inserted with direct cursor styling is undone in a single step (previously it took 3 undo steps to remove the word)
* Moving the cursor will not reset the redo stack
* Focus is re-assigned back to the event trap after completing an undo/redo step