public TextSegment GetSelectionAsSegment()
{
TextSegment result = null;
if (SelectionStart < SelectionEnd)
{
result = new TextSegment { StartOffset = SelectionStart, EndOffset = SelectionEnd };
}
else
{
result = new TextSegment { StartOffset = SelectionEnd, EndOffset = SelectionStart };
}
return result;
}