Пример #1
0
        protected override void SetTextBufferStrategy(ITextDocument textDocument)
        {
            if (TextDocument != null)
            {
                // In case the text buffer strategy already exists, we need to unset this first.
                TextDocument.Modified           -= this.TextDocument_Modified;
                TextDocument.TextSegmentAlter   -= this.TextDocument_TextSegmentAlter;
                TextDocument.TextSegmentRemoved -= this.TextDocument_TextSegmentRemoved;
                TextDocument.TextSegmentAdded   -= this.TextDocument_TextSegmentAdded;
            }

            base.SetTextBufferStrategy(textDocument);

            textDocument = TextDocument;

            textDocument.RegisterTextView(this);

            this._renderer = textDocument.GetRenderer(this);

            textDocument.TextSegmentAlter   += this.TextDocument_TextSegmentAlter;
            textDocument.TextSegmentRemoved += this.TextDocument_TextSegmentRemoved;
            textDocument.TextSegmentAdded   += this.TextDocument_TextSegmentAdded;
            textDocument.Modified           += this.TextDocument_Modified;
        }