public ColumnRange GetSelectionAtLine(int lineNumber)
{
foreach (ISelection selection in selectionCollection) {
int startLine = selection.StartPosition.Y;
int endLine = selection.EndPosition.Y;
if (startLine < lineNumber && lineNumber < endLine) {
return ColumnRange.WholeColumn;
}
if (startLine == lineNumber) {
LineSegment line = document.GetLineSegment(startLine);
int startColumn = selection.StartPosition.X;
int endColumn = endLine == lineNumber ? selection.EndPosition.X : line.Length + 1;
return new ColumnRange(startColumn, endColumn);
}
if (endLine == lineNumber) {
int endColumn = selection.EndPosition.X;
return new ColumnRange(0, endColumn);
}
}
return ColumnRange.NoColumn;
}