diff --git a/Forji/Forji/Views/DiffView.swift b/Forji/Forji/Views/DiffView.swift index 5aa607e..cc01fa0 100644 --- a/Forji/Forji/Views/DiffView.swift +++ b/Forji/Forji/Views/DiffView.swift @@ -23,6 +23,12 @@ struct DiffView: View { var body: some View { ScrollView(.horizontal) { + // `.fixedSize(horizontal:)` gives the content a definite intrinsic + // width (the widest line) inside the horizontal scroll view. Without + // it, the rows' `maxWidth: .infinity` resolves ambiguously against the + // scroll view's unspecified width proposal, so on some devices the + // content collapses to the viewport width, clipping long lines with + // nothing to scroll to instead of scrolling horizontally. LazyVStack(alignment: .leading, spacing: 0) { ForEach(Array(diff.files.enumerated()), id: \.offset) { fileIndex, file in let filePath = file.newName == "/dev/null" ? file.oldName : file.newName @@ -57,6 +63,7 @@ struct DiffView: View { } } } + .fixedSize(horizontal: true, vertical: false) } }