/// <summary> /// Create a new text document with the specified initial text. /// </summary> public TextDocument(IEnumerable <char> initialText) { if (initialText == null) { throw new ArgumentNullException(nameof(initialText)); } _rope = new Rope <char>(initialText); _lineTree = new DocumentLineTree(this); _lineManager = new LineManager(_lineTree, this); _lineTrackers.CollectionChanged += delegate { _lineManager.UpdateListOfLineTrackers(); }; _anchorTree = new TextAnchorTree(this); _undoStack = new UndoStack(); FireChangeEvents(); }