I'm trying to figure out how to prevent spell checking in my NSTextView from being applied to certain ranges within the text document.

For context, the situation I'm in is my application, MarsEdit, allows users to edit HTML source code in a regular NSTextView. In a nutshell, I want to spell-check the users plain-text "content" but avoid triggering spell-check false positives inside the HTML markup.

I'm already colorizing the markup text, so it would be reasonably easy for me to "do something" in that colorizing pass that identifies the off-limits nature of the markup text. I could for instance easily maintain an array of ranges for a document that should not be spell- checked.

The question is, how do I best limit the spell checker from applying itself to this text? So far I've been taking advantage of "check as I type" for both grammar and spelling. This seems like the most user- friendly way to support spell checking. Do I need to switch to a manual approach, using NSSpellChecker's checkSpellingOfString:startingAt: ? Would it be possible to use this manually in a manner that simulates "check as I type?"

It would be nice if NSSpellChecker offered a delegate relationship, something like "willMarkMispelledWordInRange:" ... where I could choose to have it keep quiet instead.

Appreciate any suggestions people have for me.

Daniel

_______________________________________________

Cocoa-dev mailing list ([email protected])

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