Exemple #1
0
        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();
        }