Tabset close on empty

Extend the tabsets to close when empty.
Format entire document

Add behaviors to facilitate returning the cursor to the correct position
after formating the entire document.