public void AddTextSpan(EditableRun textRun) { if (CurrentLine.IsBlankLine) { CurrentLine.AddLast(textRun); SetCurrentTextRun(textRun); CurrentLine.TextLineReCalculateActualLineSize(); CurrentLine.RefreshInlineArrange(); SetCurrentCharIndex(CharIndex + textRun.CharacterCount); } else { if (CurrentTextRun != null) { VisualPointInfo newPointInfo = CurrentLine.Split(GetCurrentPointInfo()); if (newPointInfo.IsOnTheBeginOfLine) { CurrentLine.AddBefore((EditableRun)newPointInfo.TextRun, textRun); } else { CurrentLine.AddAfter((EditableRun)newPointInfo.TextRun, textRun); } CurrentLine.TextLineReCalculateActualLineSize(); CurrentLine.RefreshInlineArrange(); EnsureCurrentTextRun(CharIndex + textRun.CharacterCount); } else { throw new NotSupportedException(); } } }
public void SplitToNewLine() { EditableRun lineBreakRun = new EditableTextRun(this.Root, '\n', this.CurrentSpanStyle); EditableRun currentRun = CurrentTextRun; if (CurrentLine.IsBlankLine) { CurrentLine.AddLast(lineBreakRun); } else { if (CharIndex == -1) { CurrentLine.AddFirst(lineBreakRun); SetCurrentTextRun(null); } else { EditableRun rightSplitedPart = EditableRun.InnerRemove(currentRun, CurrentTextRunCharIndex + 1, true); if (rightSplitedPart != null) { CurrentLine.AddAfter(currentRun, rightSplitedPart); } CurrentLine.AddAfter(currentRun, lineBreakRun); if (currentRun.CharacterCount == 0) { CurrentLine.Remove(currentRun); } } } this.TextLayer.TopDownReCalculateContentSize(); EnsureCurrentTextRun(); }
public void SplitToNewLine() { Run currentRun = CurrentTextRun; if (CurrentLine.IsBlankLine) { CurrentLine.AddLineBreakAfterLastRun(); } else { if (CharIndex == -1) { CurrentLine.AddLineBreakBeforeFirstRun(); SetCurrentTextRun(null); } else { CopyRun rightSplitedPart = Run.InnerRemove(currentRun, CurrentTextRunCharIndex + 1, true); if (rightSplitedPart != null) { CurrentLine.AddAfter(currentRun, rightSplitedPart); } CurrentLine.AddLineBreakAfter(currentRun); if (currentRun.CharacterCount == 0) { CurrentLine.Remove(currentRun); } } } this.TextLayer.TopDownReCalculateContentSize(); EnsureCurrentTextRun(); }