Is it possible to set an attribute with a range of zero on an attributed string? For example, if I set the foreground color attribute to red at NSMakeRange(0, 0) I would expect once I begin typing at the beginning, the text will be red. However, this does not seem to be the case.
How can I set the attribute “state” at a cursor location? If I hit Command+B and begin typing, the text becomes bold and has the correct attribute for the edited range. How can I duplicate this functionality for applying custom attributes?
For typing, try calling setTypingAttributes:(NSDictionary *)attributes on NSTextView.