private static void AdjustMarkupRangeCore(MarkupRange range, int offset, int length, string currentText) { MarkupPointer start = range.Start; MarkupPointer end = range.End; if (offset > 0) { start.MoveToMarkupPosition(start.Container, start.MarkupPosition + offset); } if (length < (offset + currentText.Length)) { end.MoveToMarkupPosition(start.Container, start.MarkupPosition + length); } }