Removed autocorrect from Mac OS X uiEntries. Also moved uiFreeText() to text_darwin.m.
This commit is contained in:
parent
d326407f05
commit
3069f38a9c
|
@ -29,7 +29,7 @@ void finishNewTextField(NSTextField *t, BOOL isEntry)
|
||||||
[t setBezelStyle:NSTextFieldSquareBezel];
|
[t setBezelStyle:NSTextFieldSquareBezel];
|
||||||
[t setBezeled:isEntry];
|
[t setBezeled:isEntry];
|
||||||
|
|
||||||
// TODO autocorrect comment
|
// we don't need to worry about substitutions/autocorrect here; see window_darwin.m for details
|
||||||
|
|
||||||
[[t cell] setLineBreakMode:NSLineBreakByClipping];
|
[[t cell] setLineBreakMode:NSLineBreakByClipping];
|
||||||
[[t cell] setScrollable:YES];
|
[[t cell] setScrollable:YES];
|
||||||
|
|
|
@ -12,3 +12,8 @@ char *uiDarwinNSStringToText(NSString *s)
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiFreeText(char *s)
|
||||||
|
{
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
// util_darwin.m
|
// util_darwin.m
|
||||||
extern void setStandardControlFont(NSControl *);
|
extern void setStandardControlFont(NSControl *);
|
||||||
|
extern void disableAutocorrect(NSTextView *);
|
||||||
|
|
||||||
// container_darwin.m
|
// container_darwin.m
|
||||||
@interface uiContainer : NSView
|
@interface uiContainer : NSView
|
||||||
|
|
|
@ -7,7 +7,14 @@ void setStandardControlFont(NSControl *control)
|
||||||
[control setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
[control setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiFreeText(char *s)
|
void disableAutocorrect(NSTextView *tv)
|
||||||
{
|
{
|
||||||
free(s);
|
[tv setEnabledTextCheckingTypes:0];
|
||||||
|
[tv setAutomaticDashSubstitutionEnabled:NO];
|
||||||
|
// don't worry about automatic data detection; it won't change stringValue (thanks pretty_function in irc.freenode.net/#macdev)
|
||||||
|
[tv setAutomaticSpellingCorrectionEnabled:NO];
|
||||||
|
[tv setAutomaticTextReplacementEnabled:NO];
|
||||||
|
[tv setAutomaticQuoteSubstitutionEnabled:NO];
|
||||||
|
[tv setAutomaticLinkDetectionEnabled:NO];
|
||||||
|
[tv setSmartInsertDeleteEnabled:NO];
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,14 @@ uiWindow *uiNewWindow(char *title, int width, int height)
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:YES];
|
defer:YES];
|
||||||
[d.w setTitle:toNSString(title)];
|
[d.w setTitle:toNSString(title)];
|
||||||
// TODO substitutions
|
|
||||||
|
// we do not want substitutions
|
||||||
|
// text fields, labels, etc. take their smart quotes and other autocorrect settings from their parent window, which provides a shared "field editor"
|
||||||
|
// so we have to turn them off here
|
||||||
|
// thanks akempgen in irc.freenode.net/#macdev
|
||||||
|
// for some reason, this selector returns NSText but is documented to return NSTextView...
|
||||||
|
// NOTE: if you disagree with me about disabling substitutions, start a github issue with why and I'll be happy to consider it
|
||||||
|
disableAutocorrect((NSTextView *) [d.w fieldEditor:YES forObject:nil]);
|
||||||
|
|
||||||
// this is what will destroy the window on close
|
// this is what will destroy the window on close
|
||||||
[d.w setReleasedWhenClosed:YES];
|
[d.w setReleasedWhenClosed:YES];
|
||||||
|
|
Loading…
Reference in New Issue