static void CheckStartPoint (TextDocument doc, InsertionPoint point, bool isEndPoint)
{
DocumentLine line = doc.GetLine (point.Location.Line);
if (line == null)
return;
if (doc.GetLineIndent (line).Length + 1 == point.Location.Column) {
int lineNr = point.Location.Line;
while (lineNr > 1 && doc.GetLineIndent (lineNr - 1).Length == doc.GetLine (lineNr - 1).Length) {
lineNr--;
}
line = doc.GetLine (lineNr);
point.Location = new DocumentLocation (lineNr, doc.GetLineIndent (line).Length + 1);
}
if (doc.GetLineIndent (line).Length + 1 < point.Location.Column)
point.LineBefore = NewLineInsertion.Eol;
if (point.Location.Column < line.Length + 1)
point.LineAfter = isEndPoint ? NewLineInsertion.Eol : NewLineInsertion.BlankLine;
}