AvalonStudio.TextEditor.Utils.RopeTextReader.RopeTextReader C# (CSharp) Method

RopeTextReader() public method

Creates a new RopeTextReader. Internally, this method creates a Clone of the rope; so the text reader will always read through the old version of the rope if it is modified. Rope{T}.Clone()
public RopeTextReader ( Rope rope ) : System
rope Rope
return System
		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();
			}
		}