/// <summary>
/// Creates a new AnchorSegment that creates new anchors.
/// </summary>
public AnchorSegment(TextDocument document, int offset, int length)
{
if (document == null)
{
throw new ArgumentNullException("document");
}
start = document.CreateAnchor(offset);
start.SurviveDeletion = true;
start.MovementType = AnchorMovementType.AfterInsertion;
end = document.CreateAnchor(offset + length);
end.SurviveDeletion = true;
end.MovementType = AnchorMovementType.BeforeInsertion;
}