public void Insert(int offset, string text)
        {
            if (readOnly)
            {
                return;
            }
            OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, -1, text));

            textBufferStrategy.Insert(offset, text);
            lineManager.Insert(offset, text);
            undoStack.Push(new UndoableInsert(this, offset, text));            //将当前操作推进UndoStack,以便以后可能的回复.

            OnDocumentChanged(new DocumentEventArgs(this, offset, -1, text));
        }
Beispiel #2
0
        public void Insert(int offset, string text)
        {
            if (readOnly)
            {
                return;
            }
            OnDocumentAboutToBeChanged(new DocumentEventArgs(this, offset, -1, text));
            DateTime time = DateTime.Now;

            textBufferStrategy.Insert(offset, text);

            time = DateTime.Now;
            lineTrackingStrategy.Insert(offset, text);

            time = DateTime.Now;

            undoStack.Push(new UndoableInsert(this, offset, text));

            time = DateTime.Now;
            OnDocumentChanged(new DocumentEventArgs(this, offset, -1, text));
        }