Question
In some applications, such as mail clients or Twitter clients, I find myself typing away at something, everything looks good and right when I press the send/Tweet button the text view automatically corrects the last word to an incorrect spelling. Obviously at that point I waited just the wrong amount of time after finishing typing before sending it so the spell checking was still going on.
I guess the first question here really should be what do you think about removing that functionality? Because on the other hand I'm sure that exact same thing happens to people but it actually fixes the spelling of the last word as opposed to messing it up. Otherwise if you think this is a valid idea is there a way to disable automatic spelling correction when a NSTextView loses focus?
What I've looked at:
This question on how to deal with spelling stuff in
NSTextViewsThis question on turning off spell checking all together.
NSSpellCheckerspecifically it's Auto Spelling Correction methods (I really thought this would get me somewhere) I finished wondering why aNSSpellCheckerDelegatedoesn't existThis question about
NSSpellChecker's misleading (read the comments)NSNotificationsNSTextCheckingTypes(at the bottom) specificallyNSTextCheckingTypeCorrectionThis question about doing spell checking in general
NSTextViewspecifically the 'Working With the Spelling Checker' and 'Text Checking and Substitutions' methodsThis question just about turning the functionality on and off
The Spell Checking Programming Topics which really only talks about non-automatic spell checking
NSTextViewDelegatespecifically the 'Working With the Spelling Checker' methods
What I actually tried (in Xcode in an empty project)
Implementing the
NSTextDelegatetextShouldBeginEditing:andtextShouldEndEditing:and inside of calling[self.textView setAutomaticSpellingCorrectionEnabled:true];and[self.textView setAutomaticSpellingCorrectionEnabled:false];respectively (at first I also calledNSTextView'ssetAutomaticTextReplacementEnabled:but that's just for user settings like (c) to the copyright symbol)In the same
textShouldBeginEditing:andtextShouldEndEditing:(from above) setting theNSTextView'senabledTextCheckingTypestoNSTextCheckingAllTypesandNSTextCheckingAllTypes - NSTextCheckingTypeCorrectionrespectively.Subclassing
NSTextViewand implementingbecomeFirstResponderandresignFirstResponderand in them changing the same properties as above.Calling
NSSpellCheckermethods from eitherresignFirstResponderortextShouldEndEditing:(this works with[[NSSpellChecker sharedSpellChecker] dismissCorrectionIndicatorForView:self];) to hide the popup but it still corrects the spelling)
Example
I've noticed this functionality in Tweetbot you can test it using foriegn vs foreign. If you type it in and Tweet it while the bubble is still up it will Tweet the incorrect spelling.