Improve performance of CodeMirrorAdapter.

The old adapter had to make a copy of the document after each change, so
it could find the parts of the document that got deleted by the change.
The copying, however, is expensive performance-wise.

The new approach is to use the new 'beforeChange' to record the text
that got deleted and the position of the change in the document. This
new approach has one drawback: it doesn't work when the document contains
read-only ranges.