diff --git a/TESTING.md b/TESTING.md index 6fc6100..bafdc2a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -172,9 +172,10 @@ xcrun simctl launch booted de.rfc1437.gotcha Swift, and a scripting or markup language. Keywords, strings, comments, types, and punctuation use plausible language-specific highlighting. - [ ] Open a source file containing a line wider than the screen. It does not - word-wrap; horizontal dragging pans smoothly across the complete line - without blank, black, clipped, delayed, or jumping text. Vertical - scrolling, selection, and copying still work. + word-wrap, its first line starts below the navigation bar, and horizontal + dragging pans smoothly across the complete line without blank, black, + clipped, delayed, or jumping text. Vertical scrolling, selection, and + copying still work. - [ ] Open Markdown files using the supported extensions (`.md`, `.markdown`, `.mdown`, and `.mkd`). **Preview** is selected by default and renders headings, paragraphs, emphasis, links, lists, task lists, blockquotes, diff --git a/ios/Sources/DetailScreens.swift b/ios/Sources/DetailScreens.swift index aa129f3..97c4def 100644 --- a/ios/Sources/DetailScreens.swift +++ b/ios/Sources/DetailScreens.swift @@ -458,11 +458,12 @@ final class RepositoryFileViewController: UIViewController, QLPreviewControllerD paragraph.lineBreakMode = .byClipping text.addAttribute(.paragraphStyle, value: paragraph, range: NSRange(location: 0, length: text.length)) - let scrollView = UIScrollView(frame: view.bounds) - scrollView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + let scrollView = UIScrollView() + scrollView.translatesAutoresizingMaskIntoConstraints = false scrollView.alwaysBounceHorizontal = true scrollView.isDirectionalLockEnabled = true scrollView.showsHorizontalScrollIndicator = true + scrollView.contentInsetAdjustmentBehavior = .never let textView = UITextView(frame: .zero) textView.textContainer.size = CGSize( @@ -480,6 +481,12 @@ final class RepositoryFileViewController: UIViewController, QLPreviewControllerD scrollView.addSubview(textView) displayedView = 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() }