/// <summary>
        /// Handler called every time a text is changed in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnTextChanged(WriteableChangeTextOperation operation)
        {
            bool IsSameFocus           = IsSameChangeTextOperationFocus((FocusChangeTextOperation)operation);
            int  NewCaretPosition      = ((IFocusChangeCaretOperation)operation).NewCaretPosition;
            bool ChangeCaretBeforeText = ((IFocusChangeCaretOperation)operation).ChangeCaretBeforeText;

            if (IsSameFocus && NewCaretPosition >= 0 && ChangeCaretBeforeText)
            {
                CaretPosition = NewCaretPosition;
            }

            base.OnTextChanged(operation);

            if (IsSameFocus && NewCaretPosition >= 0 && !ChangeCaretBeforeText)
            {
                CaretPosition = NewCaretPosition;
            }

            IFocusNodeState State = ((FocusChangeTextOperation)operation).State;

            Debug.Assert(State != null);
            Debug.Assert(StateViewTable.ContainsKey(State));

            ResetSelection();
            CaretAnchorPosition = CaretPosition;
            CheckCaretInvariant();
        }
        /// <summary>
        /// Handler called every time a text is changed in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnTextChanged(WriteableChangeTextOperation operation)
        {
            base.OnTextChanged(operation);

            ILayoutNodeState State = ((LayoutChangeTextOperation)operation).State;

            Debug.Assert(State != null);
            Debug.Assert(StateViewTable.ContainsKey(State));
        }