Fix occasional exception when transforming cursor before/after positions.
Rework line sentinel marking to be much more robust.
Fixes #8: Implement html import.