• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTextView, spell checking and temporary attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView, spell checking and temporary attributes


  • Subject: NSTextView, spell checking and temporary attributes
  • From: Martin Hewitson <email@hidden>
  • Date: Mon, 02 Jan 2012 19:20:46 +0100

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

  • Follow-Ups:
    • Re: NSTextView, spell checking and temporary attributes
      • From: Douglas Davidson <email@hidden>
    • Re: NSTextView, spell checking and temporary attributes
      • From: Seth Willits <email@hidden>
  • Prev by Date: Re: Static variables reset inside CFPlugin code
  • Next by Date: Re: Static variables reset inside CFPlugin code
  • Previous by thread: Re: UIView is sized out of the blue
  • Next by thread: Re: NSTextView, spell checking and temporary attributes
  • Index(es):
    • Date
    • Thread