public void Insert(int offset, string text) { //if (readOnly) { // return; //} OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, -1, text)); textBufferStrategy.Insert(offset, text); lineTrackingStrategy.Insert(offset, text); undoStack.Push(new UndoableInsert(this, offset, text)); OnDocumentChanged(new DocumentEventArgs(this, offset, -1, text)); }
public void Insert(int offset, string text) { if (!ReadOnly) { DocumentAboutToBeChanged?.Invoke(this, new DocumentEventArgs() { Document = this, Offset = offset, Length = -1, Text = text }); TextBuffer.Insert(offset, text); LineManager.Insert(offset, text); UndoStack.Push(new UndoableInsert(this, offset, text)); DocumentChanged?.Invoke(this, new DocumentEventArgs() { Document = this, Offset = offset, Length = -1, Text = text }); } }