Hi,
If you create an NSMutableAttributedString with two attributes (ie.
first some characters with one set of attributes, then some characters
with a second set of attributes) and then replace all characters with
some other string, the GSAttrInfo for the second set of attributes will
remain with its location set just past the end of the new string. I
think this is wrong. Anyway, appending a string after that will cause
the newly appended string to get the second set of attributes, which is
definitely wrong. (I've attached a test case that shows all of this.)
I assumed that there should not be any trailing attributes like this,
and that the sanity test was wrong in allowing it. I've attached a patch
that fixes the sanity test and replaceCharactersInRange:withString:.
I've tested with activated sanity tests, and it seems to work.