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));
}