void GetSelectionOffsets (DocumentLine line, out int selectionStart, out int selectionEnd)
{
selectionStart = -1;
selectionEnd = -1;
if (textEditor.IsSomethingSelected) {
TextSegment segment = textEditor.SelectionRange;
selectionStart = segment.Offset;
selectionEnd = segment.EndOffset;
if (textEditor.SelectionMode == SelectionMode.Block) {
DocumentLocation start = textEditor.MainSelection.Anchor;
DocumentLocation end = textEditor.MainSelection.Lead;
DocumentLocation visStart = textEditor.LogicalToVisualLocation (start);
DocumentLocation visEnd = textEditor.LogicalToVisualLocation (end);
int lineOffset = line.Offset;
int lineNumber = line.LineNumber;
if (textEditor.MainSelection.MinLine <= lineNumber && lineNumber <= textEditor.MainSelection.MaxLine) {
selectionStart = lineOffset + line.GetLogicalColumn (this.textEditor.GetTextEditorData (), System.Math.Min (visStart.Column, visEnd.Column)) - 1;
selectionEnd = lineOffset + line.GetLogicalColumn (this.textEditor.GetTextEditorData (), System.Math.Max (visStart.Column, visEnd.Column)) - 1;
}
}
}
}
#region Layout cache