Couple of minor clean-ups.
Tweaked the internals of CodeDocument::replaceSection so that replacing a section doesn't mess-up the position of CodeDocument::Position objects that are positioned at its start and end.