Re: NSTextView, spell checking and temporary attributes
Re: NSTextView, spell checking and temporary attributes
- Subject: Re: NSTextView, spell checking and temporary attributes
- From: Douglas Davidson <email@hidden>
- Date: Mon, 02 Jan 2012 12:29:33 -0800
Are you making other modifications to temporary attributes? The spelling indicator does use various temporary attributes, though not background color, so (for example) clearing temporary attributes would interfere with it.
Douglas Davidson
On Jan 2, 2012, at 10:20 AM, Martin Hewitson <email@hidden> wrote:
> Dear list,
>
> I have an NSTextView subclass which I've set up to highlight matching words in view. So if the user highlights a word, all matching words are highlighted. I'm doing the highlighting using a temporary attribute on the layout manager: NSBackgroundColorAttributeName.
>
> In order for this to work, I first remove this attributed in the visible range of text:
>
> [[self layoutManager] removeTemporaryAttribute:NSBackgroundColorAttributeName forCharacterRange:visibleRange];
>
> This has the unfortunate side-effect of removing the red squiggly lines which indicate misspelled words.
>
> So, I was trying to think of ways out of this. I could cycle through all temporary attributes in view and only remove those where NSBackgroundColorAttributeName is the color of my highlighting. This seems a bit heavy.
>
> I was wondering if I could do the removal and then get the text view to re-highlight the misspelled words, but I couldn't find a way to make it do that.
>
> Any ideas?
>
> Best wishes
>
> 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
_______________________________________________
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