From 522633b2eb1a2c1973347791995ddf6d969b4aaa Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Wed, 26 Aug 2020 02:13:41 +0900 Subject: [PATCH] fix: second blacklist was too tall on some systems --- src/ui/generic-components/text/TextArea.swift | 3 ++- src/ui/preferences-window/tabs/BlacklistsTab.swift | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/generic-components/text/TextArea.swift b/src/ui/generic-components/text/TextArea.swift index 97230194..6cac028d 100644 --- a/src/ui/generic-components/text/TextArea.swift +++ b/src/ui/generic-components/text/TextArea.swift @@ -2,6 +2,7 @@ import Cocoa class TextArea: NSTextField, NSTextFieldDelegate { static let padding = CGFloat(5) + static let interLineFactor = CGFloat(1.6) var callback: (() -> Void)! convenience init(_ nCharactersWide: CGFloat, _ nLinesHigh: Int, _ placeholder: String, _ callback: (() -> Void)? = nil) { @@ -10,7 +11,7 @@ class TextArea: NSTextField, NSTextFieldDelegate { delegate = self cell = TextFieldCell(placeholder, nLinesHigh == 1) let width: CGFloat = (font!.xHeight * nCharactersWide + TextArea.padding * 2).rounded() - let height: CGFloat = (fittingSize.height * CGFloat(nLinesHigh) + TextArea.padding * 2).rounded() + let height: CGFloat = (NSFont.systemFontSize * TextArea.interLineFactor * CGFloat(nLinesHigh) + TextArea.padding * 2).rounded() fit(width, height) } diff --git a/src/ui/preferences-window/tabs/BlacklistsTab.swift b/src/ui/preferences-window/tabs/BlacklistsTab.swift index c1959cc1..823d89d0 100644 --- a/src/ui/preferences-window/tabs/BlacklistsTab.swift +++ b/src/ui/preferences-window/tabs/BlacklistsTab.swift @@ -4,10 +4,10 @@ import Sparkle class BlacklistsTab { static func initTab() -> NSView { let dontShowBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Don’t show windows from these apps", comment: "")) - let dontShowBlacklist = LabelAndControl.makeTextArea(50, 3, Preferences.dontShowBlacklist.joined(separator: "\n"), "dontShowBlacklist") + let dontShowBlacklist = LabelAndControl.makeTextArea(50, 6, Preferences.dontShowBlacklist.joined(separator: "\n"), "dontShowBlacklist") let disableShortcutsBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Ignore shortcuts while a window from these apps is active", comment: "")) let disableShortcutsBlacklistCheckbox = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Only if the window is fullscreen", comment: ""), "disableShortcutsBlacklistOnlyFullscreen", labelPosition: .right) - let disableShortcutsBlacklist = LabelAndControl.makeTextArea(50, 3, Preferences.disableShortcutsBlacklist.joined(separator: "\n"), "disableShortcutsBlacklist") + let disableShortcutsBlacklist = LabelAndControl.makeTextArea(50, 6, Preferences.disableShortcutsBlacklist.joined(separator: "\n"), "disableShortcutsBlacklist") let grid = GridView([ [dontShowBlacklistLabel],