More document stuff

This goes most of the way towards completing the IDE Document reimplementation. It adds:

- selection getting and setting functionality (these apply to last active editor showing the Document)
- the editable_ methods
- the promptToSave_ methods
- the removeUndo method

Still to do:

- fix earlier issues
- general cleanup (we need to decide which duplicate methods to deprecate)

This does not deal with rich text or other related issues (these are to do with the IDE itself), only with the Document lang-IDE bridge.