in Sources/TwitterTextEditor/LayoutManager.swift [323:339]
func layoutManager(_ layoutManager: NSLayoutManager,
shouldUse action: NSLayoutManager.ControlCharacterAction,
forControlCharacterAt charIndex: Int) -> NSLayoutManager.ControlCharacterAction
{
guard let textStorage = layoutManager.textStorage else {
return action
}
let attributes = textStorage.attributes(at: charIndex, effectiveRange: nil)
guard attributes[.suffixedAttachment] is TextAttributes.SuffixedAttachment else {
return action
}
// `.whitespace` may not be set always by `NSTypesetter`.
// This is only for control glyphs inserted by `layoutManager(_:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:)`.
return .whitespace
}