diff --git a/alt-tab-macos/ui/FeedbackWindow.swift b/alt-tab-macos/ui/FeedbackWindow.swift index a352c1b0..5392ed31 100644 --- a/alt-tab-macos/ui/FeedbackWindow.swift +++ b/alt-tab-macos/ui/FeedbackWindow.swift @@ -46,8 +46,8 @@ class FeedbackWindow: NSWindow, NSTextViewDelegate { buttons.spacing = GridView.interPadding body = TextArea(80, 20, "I think the app could be improved with…") body.delegate = self - email = TextArea(80, 1.1, "Optional: email (if you want a reply)") - debugProfile = NSButton(checkboxWithTitle: "Send debug profile", target: nil, action: nil) + email = TextArea(80, 1, "Optional: email (if you want a reply)") + debugProfile = NSButton(checkboxWithTitle: "Send debug profile (CPU, memory, etc)", target: nil, action: nil) debugProfile.state = .on let view = GridView.make([ [header], diff --git a/alt-tab-macos/ui/generic-components/text/TextArea.swift b/alt-tab-macos/ui/generic-components/text/TextArea.swift index 568777da..413b0259 100644 --- a/alt-tab-macos/ui/generic-components/text/TextArea.swift +++ b/alt-tab-macos/ui/generic-components/text/TextArea.swift @@ -1,15 +1,22 @@ import Cocoa class TextArea: NSTextView { - static let paddingX = CGFloat(5) - static let paddingY = CGFloat(10) + static let padding = CGFloat(10) + static let magicOffset = CGFloat(3) @objc var placeholderAttributedString: NSAttributedString? convenience init(_ width: CGFloat, _ height: CGFloat, _ placeholder: String) { self.init(frame: .zero) font = NSFont.systemFont(ofSize: NSFont.systemFontSize) - textContainerInset = NSSize(width: TextArea.paddingX, height: TextArea.paddingY) - fit(font!.xHeight * width + TextArea.paddingX * 2, NSFont.systemFontSize * height + TextArea.paddingY * 2) - placeholderAttributedString = NSAttributedString(string: placeholder, attributes: [NSAttributedString.Key.foregroundColor: NSColor.gray]) + textContainerInset = NSSize(width: TextArea.padding, height: TextArea.padding) + textContainer!.lineFragmentPadding = 0 + let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paragraphStyle.maximumLineHeight = NSFont.systemFontSize + TextArea.magicOffset + placeholderAttributedString = NSAttributedString(string: placeholder, attributes: [ + NSAttributedString.Key.font : NSFont.systemFont(ofSize: NSFont.systemFontSize), + NSAttributedString.Key.foregroundColor: NSColor.gray, + NSAttributedString.Key.paragraphStyle: paragraphStyle, + ]) + fit(font!.xHeight * width + TextArea.padding * 2, NSFont.systemFontSize * height + TextArea.padding * 2 + TextArea.magicOffset) } }