Because of the semantics of certain NSTextView attachments in my application, I want to know when they are inserted or deleted from my text storage.
My subclass of NSTextView implements the shouldChangeTextInRange:replacementString: method, which allows me to easily see when an attachment is about to be replaced (I can search the text storage at the specified range).
Because the replacement string is just an NSString and not an NSAttributedString, I have no way of seeing from this method whether an attachment is being inserted. The documentation even goes so far as to say that the string may be nil if "only attributes" are being edited.
So the question is, what's the best override point to see when an attachment is being inserted? Or perhaps as useful: what's the best override point to see when attributes are being modified?
Update: I said above I had no way of knowing whether an attachment is being inserted. It's pointed out to me that I can tell that "an" attachment is involved, because the string will contain the magic NSAttachmentCharacter. But I won't have specific information about the attachment until after the edit is complete.