public override bool CanMerge(ITextUndoPrimitive older)
        {
            if (older == null)
            {
                throw new ArgumentNullException(nameof(older));
            }

            AfterTextBufferChangeUndoPrimitive olderPrimitive = older as AfterTextBufferChangeUndoPrimitive;

            // We can only merge with IUndoPrimitives of AfterTextBufferChangeUndoPrimitive type
            if (olderPrimitive == null)
            {
                return(false);
            }

            return(olderPrimitive.State.Matches(this.State));
        }
        public override bool CanMerge(ITextUndoPrimitive older)
        {
            if (older == null)
            {
                throw new ArgumentNullException("older");
            }

            AfterTextBufferChangeUndoPrimitive olderPrimitive = older as AfterTextBufferChangeUndoPrimitive;

            // We can only merge with IUndoPrimitives of AfterTextBufferChangeUndoPrimitive type
            if (olderPrimitive == null)
            {
                return(false);
            }

            return((olderPrimitive.CaretIndex == _oldCaretIndex) && (olderPrimitive.CaretVirtualSpace == OldCaretVirtualSpaces));
        }