private GetLineByOffset ( int offset ) : |
||
offset | int | |
return |
public DocumentLine GetLineByOffset(int offset)
{
VerifyAccess();
if (offset < 0 || offset > rope.Length) {
throw new ArgumentOutOfRangeException("offset", offset, "0 <= offset <= " + rope.Length.ToString());
}
return lineTree.GetByOffset(offset);
}
public void CheckGetLineInEmptyDocument() { Assert.AreEqual(1, document.Lines.Count); List <DocumentLine> lines = new List <DocumentLine>(document.Lines); Assert.AreEqual(1, lines.Count); DocumentLine line = document.Lines[0]; Assert.AreSame(line, lines[0]); Assert.AreSame(line, document.GetLineByNumber(1)); Assert.AreSame(line, document.GetLineByOffset(0)); }