private FormattingLock(Brainf_ckEditBox @this)
            {
                This = @this;

                @this.TextChanging -= @this.MarkdownRichEditBox_TextChanging;
                ((RichEditBox)@this).TextChanged -= @this.MarkdownRichEditBox_TextChanged;
                @this.Document.BatchDisplayUpdates();
                @this.IsUndoGroupingEnabled = true;
            }
        /// <summary>
        /// Updates the UI when the source code displayed into the <see cref="Brainf_ckEditBox"/> instance changes
        /// </summary>
        /// <param name="sender">The <see cref="Brainf_ckEditBox"/> instance in use</param>
        /// <param name="args">The arguments for the new Brainf*ck/Pbrain source code being displayed</param>
        private void CodeEditBox_TextChanged(Brainf_ckEditBox sender, TextChangedEventArgs args)
        {
            TextChanged?.Invoke(this, args);

            int numberOfLines = args.PlainText.Count(Characters.CarriageReturn);

            UpdateLineIndicators(numberOfLines);
            UpdateDiffInfo(args.PlainText);
            UpdateIndentationInfo(args.PlainText, args.ValidationResult.IsSuccessOrEmptyScript, numberOfLines);

            IdeOverlaysCanvas.Invalidate();
        }
 public static FormattingLock For(Brainf_ckEditBox @this) => new FormattingLock(@this);
 /// <summary>
 /// Raises the <see cref="CursorPositionChanged"/> event
 /// </summary>
 /// <param name="sender">The <see cref="Brainf_ckEditBox"/> instance in use</param>
 /// <param name="args">The arguments for the cursor movement</param>
 private void CodeEditBox_CursorPositionChanged(Brainf_ckEditBox sender, CursorPositionChangedEventArgs args)
 {
     CursorPositionChanged?.Invoke(this, args);
 }