I have an NSTextView. Check spelling as you type is enabled. If I misspell a word it is correctly underlined with a red line immediately after I type the word followed by a whitespace. But then the underline is removed when I begin typing a new word.

I'm guessing this is related to some things that I'm doing with the text system. I'm doing lots of syntax highlighting and things like that. Specifically I'm changing attributes in the underlying text storage, and I'm manually updating the text views current selection. But I'm not doing anything with temporary attributes, and I'm not actually modifying the underlying text.

The trouble is I'm not sure what exactly I'm doing to cause the problem. I know that spelling state is implemented with the NSSpellingStateAttributeName temporary attribute in the layout manger. So to debug things I've subclassed NSLayoutManager and overridden all the mutator methods:

- (void)addTemporaryAttributes:(NSDictionary *)attrs forCharacterRange: (NSRange)charRange - (void)addTemporaryAttribute:(NSString *)attrName value:(id)value forCharacterRange:(NSRange)charRange - (void)setTemporaryAttributes:(NSDictionary *)attrs forCharacterRange: (NSRange)charRange - (void)removeTemporaryAttribute:(NSString *)attrName forCharacterRange:(NSRange)charRange

But none of those methods seemed to be causing the problem. Then I noticed the private method:

- (void)_clearTemporaryAttributesForCharacterRange:(struct _NSRange)fp8 changeInLength:(int)fp16

And that's appears to be the one that's removing the NSSpellingStateAttributeName, but I'm not sure why. 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?

Here's a stack.

#0 0x0030777f in -[TPLayoutManager _clearTemporaryAttributesForCharacterRange:changeInLength:] at TPLayoutManager.m:77 #1 0x913ec1d7 in -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] #2 0x913ec144 in -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:]
#3      0x914a3212 in -[NSTextStorage processEditing]
#4 0x000e6620 in -[TPEntryAliasStorage processEditing] at TPEntryAliasStorage.m:355
#5      0x913d2aef in -[NSTextStorage endEditing]
#6      0x914a0fad in -[NSTextView insertText:replacementRange:]
#7      0x914a04f3 in -[NSTextView insertText:]
#8 0x914a001a in - [NSKeyBindingManager(NSKeyBindingManager_MultiClients) flushTextForClient:]
#9      0x9149e56f in -[NSTSMInputContext interpretKeyEvents:]
#10     0x9149e03a in -[NSView interpretKeyEvents:]
#11     0x9149df4a in -[NSTextView keyDown:]
#12 0x0030a500 in -[TPEntryAliasesTextView keyDown:] at TPEntryAliasesTextView.m:161
#13     0x9140e4c5 in -[NSWindow sendEvent:]
#14     0x913da431 in -[NSApplication sendEvent:]
#15     0x91337e27 in -[NSApplication run]
#16     0x91305030 in NSApplicationMain
#17     0x0000253d in main at main.m:17

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to