performance improvement on textDidChange method

This commit is contained in:
Ian Bastos 2020-01-12 15:07:36 +00:00
parent 544987f19a
commit 14288b9b0c
1 changed files with 6 additions and 4 deletions

View File

@ -32,11 +32,13 @@ struct uiMultilineEntry {
return self; return self;
} }
// [e->tv setTextColor:[NSColor textColor]] in finishMultilineentry
// does not work due to an cocoa bug which stops the text
// from changing pre control initialization so we resort
// to changing the text on the delegate method instead
- (void)textDidChange:(NSNotification *)aNotification { - (void)textDidChange:(NSNotification *)aNotification {
NSTextView *tv = (NSTextView *)[aNotification object]; NSTextView *tv = (NSTextView *)[aNotification object];
if (isDarkMode()) { [tv setTextColor:[NSColor textColor]];
[tv setTextColor:[NSColor whiteColor]];
}
} }
- (NSSize)intrinsicContentSize - (NSSize)intrinsicContentSize
@ -149,7 +151,7 @@ static uiMultilineEntry *finishMultilineEntry(BOOL hscroll)
[e->tv setRulerVisible:NO]; [e->tv setRulerVisible:NO];
if (isDarkMode()) { if (isDarkMode()) {
[e->tv setBackgroundColor:[NSColor windowBackgroundColor]]; [e->tv setBackgroundColor:[NSColor controlBackgroundColor]];
} else { } else {
[e->tv setBackgroundColor:[NSColor colorWithCalibratedWhite:1.0 alpha:1.0]]; [e->tv setBackgroundColor:[NSColor colorWithCalibratedWhite:1.0 alpha:1.0]];
} }