BeginUpdate() public méthode

Begins a group of document changes.

Some events are suspended until EndUpdate is called, and the UndoStack will group all changes into a single action.

Calling BeginUpdate several times increments a counter, only after the appropriate number of EndUpdate calls the events resume their work.

public BeginUpdate ( ) : void
Résultat void
        public void RawlyIndentLine(int tabsToInsert, TextDocument document, DocumentLine line)
        {
            if (!_doBeginUpdateManually)
                document.BeginUpdate();
            /*
             * 1) Remove old indentation
             * 2) Insert new one
             */

            // 1)
            int prevInd = 0;
            int curOff = line.Offset;
            if (curOff < document.TextLength)
            {
                char curChar = '\0';
                while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
                {
                    prevInd++;
                    curOff++;
                }

                document.Remove(line.Offset, prevInd);
            }

            // 2)
            string indentString = "";
            for (int i = 0; i < tabsToInsert; i++)
                indentString += dEditor.Editor.Options.IndentationString;

            document.Insert(line.Offset, indentString);
            if (!_doBeginUpdateManually)
                document.EndUpdate();
        }
Exemple #2
0
        public void RawlyIndentLine(string indentString, ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line)
        {
            if (!_doBeginUpdateManually)
            {
                document.BeginUpdate();
            }

            // 1)
            int prevInd = 0;
            int curOff  = line.Offset;

            if (curOff < document.TextLength)
            {
                char curChar = '\0';
                while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
                {
                    prevInd++;
                    curOff++;
                }

                document.Remove(line.Offset, prevInd);
            }

            document.Insert(line.Offset, indentString);
            if (!_doBeginUpdateManually)
            {
                document.EndUpdate();
            }
        }
 public TextDocumentWriter(TextDocument doc)
 {
   _doc = doc;
   _doc.BeginUpdate();
   _undoStackSize = doc.UndoStack.SizeLimit;
   _doc.UndoStack.SizeLimit = 0;
   _i = _doc.TextLength;
 }
Exemple #4
0
 internal void RegisterAffectedDocument(TextDocument document)
 {
     if (affectedDocuments == null)
     {
         affectedDocuments = new List <TextDocument>();
     }
     if (!affectedDocuments.Contains(document))
     {
         affectedDocuments.Add(document);
         document.BeginUpdate();
     }
 }
 public void IndentLines(TextDocument document, int beginLine, int endLine)
 {
     _doBeginUpdateManually = true;
     document.BeginUpdate();
     while (beginLine <= endLine)
     {
         IndentLine(document, document.GetLineByNumber(beginLine));
         beginLine++;
     }
     document.EndUpdate();
     _doBeginUpdateManually = false;
 }
Exemple #6
0
        public void RawlyIndentLine(int tabsToInsert, ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line)
        {
            if (!_doBeginUpdateManually)
            {
                document.BeginUpdate();
            }

            /*
             * 1) Remove old indentation
             * 2) Insert new one
             */

            // 1)
            int prevInd = 0;
            int curOff  = line.Offset;

            if (curOff < document.TextLength)
            {
                char curChar = '\0';
                while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
                {
                    prevInd++;
                    curOff++;
                }

                document.Remove(line.Offset, prevInd);
            }

            // 2)
            string indentString = "";

            for (int i = 0; i < tabsToInsert; i++)
            {
                indentString += dEditor.Editor.Options.IndentationString;
            }

            document.Insert(line.Offset, indentString);
            if (!_doBeginUpdateManually)
            {
                document.EndUpdate();
            }
        }
Exemple #7
0
 internal void RegisterAffectedDocument(TextDocument document)
 {
     if (affectedDocuments == null)
         affectedDocuments = new List<TextDocument>();
     if (!affectedDocuments.Contains(document))
     {
         affectedDocuments.Add(document);
         document.BeginUpdate();
     }
 }