public static string GetNewLineFromDocument(IDocument document, int lineNumber)
{
var line = document.GetLineByNumber(lineNumber);
if (line.DelimiterLength == 0)
{
// at the end of the document, there's no line delimiter, so use the delimiter
// from the previous line
line = line.PreviousLine;
if (line == null)
return Environment.NewLine;
}
return document.GetText(line.Offset + line.Length, line.DelimiterLength);
}
}