Alsing.SourceCode.SyntaxDocument.InsertText C# (CSharp) Метод

InsertText() публичный Метод

Inserts a text into the document at a given column,row.
public InsertText ( string text, int xPos, int yPos, bool StoreUndo ) : TextPoint
text string Text to insert
xPos int Column
yPos int Row index
StoreUndo bool true if this action should be pushed onto the undo stack
Результат TextPoint
        public TextPoint InsertText(string text, int xPos, int yPos, bool StoreUndo)
        {
            Modified = true;
            Row xtr = this[yPos];
            if (xPos > xtr.Text.Length)
            {
                //virtualwhitespace fix
                int Padd = xPos - xtr.Text.Length;
                var PaddStr = new string(' ', Padd);
                text = PaddStr + text;
                xPos -= Padd;
            }
            string lft = xtr.Text.Substring(0, xPos);
            string rgt = xtr.Text.Substring(xPos);
            string NewText = lft + text + rgt;


            string t = NewText.Replace(Environment.NewLine, "\n");
            string[] lines = t.Split('\n');
            xtr.Text = lines[0];

            Row lastrow = xtr;

            //this.Parser.ParsePreviewLine(xtr);	
            xtr.Parse();
            if (!xtr.InQueue)
                ParseQueue.Add(xtr);
            xtr.InQueue = true;

            int i = IndexOf(xtr);
            for (int j = 1; j <= lines.GetUpperBound(0); j++)
            {
                lastrow = Insert(lines[j], j + i, false);
            }

            if (StoreUndo)
                PushUndoBlock(UndoAction.InsertRange, text, xPos, yPos);

            ResetVisibleRows();
            OnChange();


            return new TextPoint(lastrow.Text.Length - rgt.Length, IndexOf(lastrow));
        }

Same methods

SyntaxDocument::InsertText ( string text, int xPos, int yPos ) : TextPoint