public void ReplaceCurrentTextRunContent(int nBackSpace, EditableRun newTextRun)
{
if (newTextRun != null)
{
EnableUndoHistoryRecording = false; for (int i = 0; i < nBackSpace; i++)
{
DoBackspace();
}
EnableUndoHistoryRecording = true;
int startLineNum = textLineWriter.LineNumber;
int startCharIndex = textLineWriter.CharIndex;
textLineWriter.AddTextSpan(newTextRun);
textLineWriter.EnsureCurrentTextRun();
commandHistory.AddDocAction(
new DocActionInsertRuns(
new EditableRun[] { newTextRun }, startLineNum, startCharIndex,
textLineWriter.LineNumber, textLineWriter.CharIndex));
}
}