Insert() public method

public Insert ( int offset, string text ) : void
offset int
text string
return void
示例#1
0
        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
                });
            }
        }