Re: disappearing NSSpellingStateAttributeName
Re: disappearing NSSpellingStateAttributeName
- Subject: Re: disappearing NSSpellingStateAttributeName
- From: Martin Wierschin <email@hidden>
- Date: Wed, 18 Jun 2008 14:41:29 -0700
Does anyone know what causes the
_clearTemporaryAttributesForCharacterRange method to get called...
and have theories on why it's being called in my app and why the
NSSpellingStateAttributeName that it is clearing isn't being replaced?
I believe that method should only be called when the character
contents of the text storage have changed, not the attributes. I
would guess that your syntax coloring (or other attribute
modifications) are making their changes within a bracketed edit (eg:
while a beginEditing call hasn't been closed by a corresponding
endEditing). Basically the edited range/flags are all unioned
together so it would all appear as one giant text change to the
layout manager. Imagine the call sequence:
NSTextStorage* ts = whatever;
[ts beginEditing];
[ts replaceCharactersInRange:NSMakeRange(0,0) withString:@"x"];
[ts addAttribute:NSWhateverAttributeName value:whatever
range:NSMakeRange(0, [ts length])];
[ts endEditing];
When the layout manager is notified from processEditing the
editedMask/editedRange will specify both characters and attributes
have changed across the whole storage. Thus the layout manager would
clear away temporary attributes for the entire storage.
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden