Replace() public method

public Replace ( int offset, int length, string text ) : void
offset int
length int
text string
return void
Ejemplo n.º 1
0
        public void Replace(int offset, int length, string text)
        {
            if (readOnly)
            {
                return;
            }
            OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, length, text));
            undoStack.Push(new UndoableReplace(this, offset, GetText(offset, length), text));

            textBufferStrategy.Replace(offset, length, text);
            lineTrackingStrategy.Replace(offset, length, text);

            OnDocumentChanged(new DocumentEventArgs(this, offset, length, text));
        }
        public void Replace(int offset, int length, string text)
        {
            if (!ReadOnly)
            {
                DocumentAboutToBeChanged?.Invoke(this, new DocumentEventArgs()
                {
                    Document = this, Offset = offset, Length = length, Text = text
                });
                UndoStack.Push(new UndoableReplace(this, offset, GetText(offset, length), text));

                TextBuffer.Replace(offset, length, text);
                LineManager.Replace(offset, length, text);

                DocumentChanged?.Invoke(this, new DocumentEventArgs()
                {
                    Document = this, Offset = offset, Length = length, Text = text
                });
            }
        }