// Constructor. public TextTree(TextBuffer buffer, TextLayout layout) { // set the buffer for this text tree this.buffer = buffer; // set the layout for this text tree this.layout = layout; // set the root for this text tree root = new TextGroup(); // insert a new line into the buffer buffer.Insert(0, '\n'); // create the first line TextLine line = new TextLine (buffer.MarkPosition(0, true), buffer.MarkPosition(1, true)); // insert the first line into the tree root.InsertChild(null, line); // update the metrics information root.UpdateMetrics(layout, true); // create the caret position caret = buffer.MarkPosition(0, false); // create the selection position selection = buffer.MarkPosition(0, false); }
// Constructor. public TextLine(ITextMark start, ITextMark end) : base() { // set the start position for this line this.start = start; // set the end position for this line this.end = end; // set the character count charCount = (end.Offset - start.Offset); // set the line count for this line lineCount = 1; }