Keep source files below navigation bar

This commit is contained in:
Georg Bauer
2026-07-31 14:13:27 +02:00
parent a2615d5d83
commit c5ecb8f87d
2 changed files with 13 additions and 5 deletions

View File

@@ -172,9 +172,10 @@ xcrun simctl launch booted de.rfc1437.gotcha
Swift, and a scripting or markup language. Keywords, strings, comments, Swift, and a scripting or markup language. Keywords, strings, comments,
types, and punctuation use plausible language-specific highlighting. types, and punctuation use plausible language-specific highlighting.
- [ ] Open a source file containing a line wider than the screen. It does not - [ ] Open a source file containing a line wider than the screen. It does not
word-wrap; horizontal dragging pans smoothly across the complete line word-wrap, its first line starts below the navigation bar, and horizontal
without blank, black, clipped, delayed, or jumping text. Vertical dragging pans smoothly across the complete line without blank, black,
scrolling, selection, and copying still work. clipped, delayed, or jumping text. Vertical scrolling, selection, and
copying still work.
- [ ] Open Markdown files using the supported extensions (`.md`, `.markdown`, - [ ] Open Markdown files using the supported extensions (`.md`, `.markdown`,
`.mdown`, and `.mkd`). **Preview** is selected by default and renders `.mdown`, and `.mkd`). **Preview** is selected by default and renders
headings, paragraphs, emphasis, links, lists, task lists, blockquotes, headings, paragraphs, emphasis, links, lists, task lists, blockquotes,

View File

@@ -458,11 +458,12 @@ final class RepositoryFileViewController: UIViewController, QLPreviewControllerD
paragraph.lineBreakMode = .byClipping paragraph.lineBreakMode = .byClipping
text.addAttribute(.paragraphStyle, value: paragraph, range: NSRange(location: 0, length: text.length)) text.addAttribute(.paragraphStyle, value: paragraph, range: NSRange(location: 0, length: text.length))
let scrollView = UIScrollView(frame: view.bounds) let scrollView = UIScrollView()
scrollView.autoresizingMask = [.flexibleWidth, .flexibleHeight] scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.alwaysBounceHorizontal = true scrollView.alwaysBounceHorizontal = true
scrollView.isDirectionalLockEnabled = true scrollView.isDirectionalLockEnabled = true
scrollView.showsHorizontalScrollIndicator = true scrollView.showsHorizontalScrollIndicator = true
scrollView.contentInsetAdjustmentBehavior = .never
let textView = UITextView(frame: .zero) let textView = UITextView(frame: .zero)
textView.textContainer.size = CGSize( textView.textContainer.size = CGSize(
@@ -480,6 +481,12 @@ final class RepositoryFileViewController: UIViewController, QLPreviewControllerD
scrollView.addSubview(textView) scrollView.addSubview(textView)
displayedView = scrollView displayedView = scrollView
view.addSubview(scrollView) view.addSubview(scrollView)
NSLayoutConstraint.activate([
scrollView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
scrollView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
])
updateSourceLayout() updateSourceLayout()
} }