public RopeTextReader(Rope<char> rope)
{
if (rope == null)
throw new ArgumentNullException("rope");
// We force the user to iterate through a clone of the rope to keep the API contract of RopeTextReader simple
// (what happens when a rope is modified while iterating through it?)
rope.root.Publish();
// special case for the empty rope:
// leave currentNode initialized to null (RopeTextReader doesn't support empty nodes)
if (rope.Length != 0)
{
currentNode = rope.root;
GoToLeftMostLeaf();
}
}