views:

14

answers:

1

I'm working with a NSTextView and have a delegate set for its -textStorage property. Upon receipt of -textStorageDidProcessEditing: I need to apply attributes to portions of the text.

My attributes are being applied, but they are always applied to the text before I made the edit, even though I'm invoking NSLayoutManager's methods not from -will... but did....

It's as if the layout manager does not know about the recent glyph insertion/deletion at this point in execution, so I assume NSTextView/NSTextStorage invokes the delegate method then notifies the layout manager to update.

Is there a way I can force the layout manager to update with immediate effect so that I can get this to work?

I'm aware of NSTextStorage's -addAttribute:value:range: method(s) and have been using those successfully up to this point, but I've hit a point where I need to now do this via the layout manager instead as part of a refactoring/optimizing exercise.