From fbdeaecbfbbf74619df83600db9e4f4e01a7d765 Mon Sep 17 00:00:00 2001 From: Stefan Hausotte Date: Wed, 15 Jul 2026 14:30:05 +0200 Subject: [PATCH] fix: make code diffs reliably horizontally scrollable (#85) Diff rows use maxWidth: .infinity inside a horizontal ScrollView, whose width proposal is unspecified. The resolution against a LazyVStack's cross-axis estimate was non-deterministic across devices: some scrolled, others collapsed to the viewport width and clipped long lines with no way to scroll. Give the content a definite intrinsic width via fixedSize so horizontal scrolling works on every device. --- Forji/Forji/Views/DiffView.swift | 7 +++++++ 1 file changed, 7 insertions(+) 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) } }