UITextView can split an NSAttributedString and set new font attribute if some substring has a different language which needs another font (for example when the mention include both English and Korean, the Korean substring will have another font attribute then the default one set to that UITextView).
After the "split", each substring still had the same pointer to the same HKWMentionsAttribute, which repeatedly changed its range to the latest, and then made the buffer include the same HKWMentionsAttribute pointer multiple times and prevented access to all mention attributes.
Here I just created a new attribute and set the range to it, so at least we can iterate all ranges and decide if we want to merge or not, depending on the use case.
UITextView
can split anNSAttributedString
and set newfont
attribute if some substring has a different language which needs another font (for example when the mention include both English and Korean, the Korean substring will have anotherfont
attribute then the default one set to thatUITextView
). After the "split", each substring still had the same pointer to the sameHKWMentionsAttribute
, which repeatedly changed itsrange
to the latest, and then made thebuffer
include the sameHKWMentionsAttribute
pointer multiple times and prevented access to all mention attributes.Here I just created a new attribute and set the range to it, so at least we can iterate all ranges and decide if we want to merge or not, depending on the use case.