bool IsInsideSelection (DocumentLocation clickLocation)
{
var selection = textEditor.MainSelection;
if (selection.SelectionMode == SelectionMode.Block) {
int minColumn = System.Math.Min (selection.Anchor.Column, selection.Lead.Column);
int maxColumn = System.Math.Max (selection.Anchor.Column, selection.Lead.Column);
return selection.MinLine <= clickLocation.Line && clickLocation.Line <= selection.MaxLine &&
minColumn <= clickLocation.Column && clickLocation.Column <= maxColumn;
}
return selection.Start <= clickLocation && clickLocation < selection.End;
}