editor: add utility to track changes in the source buffer.

This only handles insertions at the moment. Followup commits will add
support for handling deletions from the buffer.
editor: start tracking deletes.

Still some junk to work out, but getting close.
editor: fix eronious insertion of extra lines.