My Cocoa application uses NSTextView. It is sort of an editor application. Now in 10.6 there is character substitution so (c) becomes copyright. My application was not doing the substitution in 10.6. And I did not add any additional code for that. But in 10.7 the substitution is taking place. This is causing confusion to clients who have just migrated to lion. I know that I can write an applescript to disable the checkbox in language and text. But is there any other option ?.
I also tried
defaults write -g WebAutomaticDashSubstitutionEnabled -bool false.
but this also did not work.
In Cocoa, the substitutions feature is called “automatic text replacement”. To disable it in an NSTextView, send the text view a
setAutomaticTextReplacementEnabled:message.You should consider whether it’s really appropriate to disable that in your application, though. If your editor is intended to be used on code or data files, then yes, you probably should disable it. If it’s for editing text files, however, it’s probably better to leave it set to the default and let users discover the feature on their own (and turn it off themselves if they don’t want it). If your application is a text editor that may be used on text or code, you can probably set it based on what format the file is in—for example, enable it for Markdown but disable it for Python.
The
WebAutomaticDashSubstitutionEnabledpreference is not relevant because, as its name says, it’s a WebKit feature. NSTextView is part of AppKit and does not use WebKit. Also, automatic dash substitution, which is supported in NSTextView as well, is a different feature.