Skip to content

Commit db5500f

Browse files
committed
fix: improve acknowledgments tab (closes #4025)
1 parent 42bbd0f commit db5500f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/ui/preferences-window/tabs/AcknowledgmentsTab.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,35 @@ class AcknowledgmentsTab {
77
static func initTab() -> NSView {
88
let textViews: [NSTextView] = ["Contributors", "Acknowledgments"].map {
99
let markdownFileUrl = Bundle.main.url(forResource: $0, withExtension: "md")!
10-
let content = try! String(contentsOf: markdownFileUrl, encoding: .utf8)
10+
var content = try! String(contentsOf: markdownFileUrl, encoding: .utf8)
11+
if content.last == "\n" {
12+
content.removeLast()
13+
}
1114
let attributedString = Markdown.toAttributedString(content)
1215
let textView = NSTextView()
1316
textView.textContainer!.widthTracksTextView = true
1417
textView.translatesAutoresizingMaskIntoConstraints = false
15-
textView.drawsBackground = true
16-
textView.backgroundColor = .clear
18+
textView.drawsBackground = false
1719
textView.isSelectable = true
1820
textView.isEditable = false
1921
textView.enabledTextCheckingTypes = 0
20-
textView.frame.size.width = 230
22+
textView.frame.size.width = 240
2123
textView.textStorage!.setAttributedString(attributedString)
2224
textView.layoutManager!.ensureLayout(for: textView.textContainer!)
2325
textView.frame = textView.layoutManager!.usedRect(for: textView.textContainer!)
2426
textView.fit(textView.frame.width, textView.frame.height)
2527
return textView
2628
}
2729
let subGrid = GridView([textViews])
28-
subGrid.column(at: 1).leadingPadding = 20
2930
subGrid.fit()
3031

31-
let scrollView = ScrollView()
32+
let scrollView = NSScrollView()
3233
scrollView.translatesAutoresizingMaskIntoConstraints = false
34+
scrollView.drawsBackground = false
35+
scrollView.hasVerticalScroller = true
36+
scrollView.hasHorizontalScroller = false
37+
scrollView.documentView = FlippedView(frame: .zero)
3338
scrollView.documentView!.translatesAutoresizingMaskIntoConstraints = false
34-
scrollView.scrollerKnobStyle = .default
3539
scrollView.documentView!.subviews = [subGrid]
3640
let totalWidth = subGrid.fittingSize.width
3741
scrollView.frame.size = NSSize(width: totalWidth, height: maxTabHeight)

0 commit comments

Comments
 (0)