MonoDevelop.Refactoring.InsertionPointService.CheckStartPoint C# (CSharp) Method

CheckStartPoint() static private method

static private CheckStartPoint ( IReadonlyTextDocument doc, MonoDevelop.Ide.Editor.InsertionPoint point, bool isEndPoint ) : void
doc IReadonlyTextDocument
point MonoDevelop.Ide.Editor.InsertionPoint
isEndPoint bool
return void
		static void CheckStartPoint (IReadonlyTextDocument doc, InsertionPoint point, bool isEndPoint)
		{
			var 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;
		}