Re: Disable Text Replacement
Hi Andy, NSLog(@isAutomaticTextReplacementEnabled %d, [NSSpellChecker isAutomaticTextReplacementEnabled]); NSLog(@isAutomaticSpellingCorrectionEnabled %d, [NSSpellChecker isAutomaticSpellingCorrectionEnabled]); but no corresponding set methods!? Note that you're messaging the NSSpellChecker class and not your NSTextView instance. I do both and realised in the meanwhile that the SpellChecker class methods reflect back the System Preferences settings. This is neat. I can’t use the since I don’t want to change anything system wide, only application specific. So you can do this: [_textView setAutomaticTextReplacementEnabled:NO]; So what I currently do and what works is #ifdef __APPLE__ [self setAutomaticQuoteSubstitutionEnabled:NO]; [self setContinuousSpellCheckingEnabled:NO]; [self setAutomaticTextReplacementEnabled:NO]; [self setEnabledTextCheckingTypes:NO]; // -- this is critical and required to get rid of the unwanted text replacements #endif However, the “setEnabledTextCheckingTypes:NO” line is necessary. If I commit that I still get replacements, e.g. two minus signs — are replaced with “?”. I for sure haven’t implemented this replacement!? It does not happen, if I paste the two characters into the textview, only if I type them!? Who is doing that and why? Shouldn’t this be suppressed with setAutomaticTextReplacementEnabled:NO!?? Thanks, Andreas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disable Text Replacement
Have you tried turning off automaticDashSubstitutionEnabled? —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disable Text Replacement
On Feb 10, 2015, at 6:15 AM, Andreas Höschler ahoe...@smartsoft.de wrote: I also found NSLog(@isAutomaticTextReplacementEnabled %d, [NSSpellChecker isAutomaticTextReplacementEnabled]); NSLog(@isAutomaticSpellingCorrectionEnabled %d, [NSSpellChecker isAutomaticSpellingCorrectionEnabled]); but no corresponding set methods!? Note that you're messaging the NSSpellChecker class and not your NSTextView instance. Those class methods on NSSpellChecker reflect system-wide settings. For example, +isAutomaticSpellingCorrectionEnabled reflects the state of the checkbox at System Preferences Keyboard Text Correct spelling automatically. You can see this for yourself: go to System Preferences, change that checkbox, run your program again, and the NSLog will print a different value. When a text view is created it uses your system-wide settings for spelling correction, etc. Thereafter it is possible to change the settings for the text view independently of the system-wide settings. To see this for yourself: right-click a text view and look at Spelling and Grammar. There's a Correct Spelling Automatically menu item that you can toggle that affects just that text view. [NSSpellChecker setAutomaticTextReplacementEnabled:NO]; — method does not exist Again, you're messaging the NSSpellChecker class rather than your NSTextView instance. NSSpellChecker does not have a +setAutomaticTextReplacementEnabled: class method, but NSTextView *does* have a -setAutomaticTextReplacementEnabled: instance method. So you can do this: [_textView setAutomaticTextReplacementEnabled:NO]; --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disable Text Replacement
On Feb 10, 2015, at 11:42 AM, Andreas Höschler ahoe...@smartsoft.de wrote: What puzzles me is that [self respondsToSelector:@selector(setAutomaticQuoteSubstitutionEnabled:)] returns NO!? How can this be? It can't, assuming self is an NSTextView (or, as you seem to be using, a subclass of NSTextView). How do you know the above returns NO? Are you using NSLog to print it? If so, also log what self is, something like this: NSLog(@%@ %d, [self className], [self respondsToSelector:@selector(setAutomaticQuoteSubstitutionEnabled:)]); I subclassed NSTextView and the above NSLog printed this: 2015-02-10 21:27:21.747 MyApp[69306:303] MyTextView 1 --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disable Text Replacement
Hi Jens, Have you tried turning off automaticDashSubstitutionEnabled? Thanks a lot for you response. I goggled for automaticDashSubstitutionEnabled and landed here: http://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes http://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes On this page I found Also you can use this for a more detailed control over the text replacement. self.textView.enabledTextCheckingTypes = 0; See NSTextView setEnabledTextCheckingTypes: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextView_Class/Reference/Reference.html#//apple_ref/occ/instm/NSTextView/setEnabledTextCheckingTypes%3a I finally solved the problem by doing: - (id)initWithFrame:(NSRect)frameRect textContainer:(NSTextContainer *)container { self = [super initWithFrame:frameRect textContainer:container]; ... [self setAutomaticQuoteSubstitutionEnabled:NO]; [self setContinuousSpellCheckingEnabled:NO]; [self setAutomaticTextReplacementEnabled:NO]; [self setEnabledTextCheckingTypes:NO]; // — this is critical and required to get rid of the unwanted text replacements ... return self; } What puzzles me is that [self respondsToSelector:@selector(setAutomaticQuoteSubstitutionEnabled:)] returns NO!? How can this be? Anyway, thanks a lot for your hint! Problem solved! Andreas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Disable Text Replacement
Hi all, I have done [_textView setAutomaticTextReplacementEnabled:NO]; Still, when I enter three dots . . . into this textview they still get replacement with some unicode character!? Who is doing this replacement and how can this be disabled programmatically? I also found NSLog(@isAutomaticTextReplacementEnabled %d, [NSSpellChecker isAutomaticTextReplacementEnabled]); NSLog(@isAutomaticSpellingCorrectionEnabled %d, [NSSpellChecker isAutomaticSpellingCorrectionEnabled]); but no corresponding set methods!? [NSSpellChecker setAutomaticTextReplacementEnabled:NO]; — method does not exist What is the correct way of switching this replacement stuff off? This might be need in a word-process but when developing an editor for code it is a show-stopper! Thanks a lot, Andreas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com