Exemple #1
0
 public bool CanAcceptThisChar(char c)
 {
     //TODO: review here, enable this feature or not
     //some char can't be a start char on blank line
     if (CurrentLine.IsBlankLine &&
         !InternalTextLayerController.CanCaretStopOnThisChar(c))
     {
         return(false);
     }
     return(true);
 }
Exemple #2
0
        public void AddCharacter(char c)
        {
            if (CurrentLine.IsBlankLine)
            {
                //TODO: review here, enable this feature or not
                //some char can't be a start char on blank line

                if (!InternalTextLayerController.CanCaretStopOnThisChar(c))
                {
                    return;
                }
                //

                //1. new
                EditableRun t = new EditableTextRun(this.RootGfx,
                                                    c,
                                                    this.CurrentSpanStyle);
                var owner = this.FlowLayer.OwnerRenderElement;
                CurrentLine.AddLast(t);
                SetCurrentTextRun(t);
            }
            else
            {
                EditableRun cRun = CurrentTextRun;
                if (cRun != null)
                {
                    if (cRun.IsInsertable)
                    {
                        cRun.InsertAfter(CurrentTextRunCharIndex, c);
                    }
                    else
                    {
                        AddTextSpan(new EditableTextRun(this.RootGfx, c, this.CurrentSpanStyle));
                        return;
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            CurrentLine.TextLineReCalculateActualLineSize();
            CurrentLine.RefreshInlineArrange();
            SetCurrentCharStepRight();
        }