Skip to content

Commit

Permalink
fix: improve acknowledgments tab (closes #4025)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Dec 25, 2024
1 parent 42bbd0f commit db5500f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/ui/preferences-window/tabs/AcknowledgmentsTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@ class AcknowledgmentsTab {
static func initTab() -> NSView {
let textViews: [NSTextView] = ["Contributors", "Acknowledgments"].map {
let markdownFileUrl = Bundle.main.url(forResource: $0, withExtension: "md")!
let content = try! String(contentsOf: markdownFileUrl, encoding: .utf8)
var content = try! String(contentsOf: markdownFileUrl, encoding: .utf8)
if content.last == "\n" {
content.removeLast()
}
let attributedString = Markdown.toAttributedString(content)
let textView = NSTextView()
textView.textContainer!.widthTracksTextView = true
textView.translatesAutoresizingMaskIntoConstraints = false
textView.drawsBackground = true
textView.backgroundColor = .clear
textView.drawsBackground = false
textView.isSelectable = true
textView.isEditable = false
textView.enabledTextCheckingTypes = 0
textView.frame.size.width = 230
textView.frame.size.width = 240
textView.textStorage!.setAttributedString(attributedString)
textView.layoutManager!.ensureLayout(for: textView.textContainer!)
textView.frame = textView.layoutManager!.usedRect(for: textView.textContainer!)
textView.fit(textView.frame.width, textView.frame.height)
return textView
}
let subGrid = GridView([textViews])
subGrid.column(at: 1).leadingPadding = 20
subGrid.fit()

let scrollView = ScrollView()
let scrollView = NSScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.drawsBackground = false
scrollView.hasVerticalScroller = true
scrollView.hasHorizontalScroller = false
scrollView.documentView = FlippedView(frame: .zero)
scrollView.documentView!.translatesAutoresizingMaskIntoConstraints = false
scrollView.scrollerKnobStyle = .default
scrollView.documentView!.subviews = [subGrid]
let totalWidth = subGrid.fittingSize.width
scrollView.frame.size = NSSize(width: totalWidth, height: maxTabHeight)
Expand Down

0 comments on commit db5500f

Please sign in to comment.