internal bool CalculateClickLocation (double x, double y, out DocumentLocation clickLocation)
{
VisualLocationTranslator trans = new VisualLocationTranslator (this);
clickLocation = trans.PointToLocation (x, y, snapCharacters: true);
if (clickLocation.Line < DocumentLocation.MinLine || clickLocation.Column < DocumentLocation.MinColumn)
return false;
DocumentLine line = Document.GetLine (clickLocation.Line);
if (line != null && clickLocation.Column >= line.Length + 1 && GetWidth (Document.GetTextAt (line.SegmentIncludingDelimiter) + "-") < x) {
clickLocation = new DocumentLocation (clickLocation.Line, line.Length + 1);
if (textEditor.GetTextEditorData ().HasIndentationTracker && textEditor.Options.IndentStyle == IndentStyle.Virtual && clickLocation.Column == 1) {
int indentationColumn = this.textEditor.GetTextEditorData ().GetVirtualIndentationColumn (clickLocation);
if (indentationColumn > clickLocation.Column)
clickLocation = new DocumentLocation (clickLocation.Line, indentationColumn);
}
}
return true;
}