~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

The iOS app's code view scrolls sideways rather than wrapping

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:ios/code-scroll

What changes

A file's lines in the iOS app stay on one row each, and the code scrolls sideways under line numbers that stay put. just ios-look can now swipe left and right too.

Why

Long lines wrapped into the column under the code, which broke up the indentation and made one line read as several.

How it was checked

Drawn with just ios-look on a file with a long URL, an emoji and Japanese in a line, 150 lines long, before and after a swipe left: the numbers stay and each row lines up with its number.

Shortcomings

A pull's diff still wraps.

🤖 Generated with Claude Code

code2.png

Approved

This pull replaces the wrapping code view with one where each line stays on a single row. The code scrolls sideways under a fixed line-number column. Rows have a fixed, Dynamic-Type-scaled height so the two columns stay aligned. It also adds left and right swipes to ios-look. I found no blocking problems, and I don't see a docs or changeset requirement for an iOS-only view change. The one thing to fix is the widest-line pick, noted below. I read the full diff but did not build or run the app.

ios/Knotless/Views/CodeViews.swiftline 78
}
.padding(.leading, 8)
ScrollView(.horizontal) {
column(widest: lines.max { $0.count < $1.count } ?? "", alignment: .leading) { i in
review.knotless.dev

The widest line is picked by Character count, but the width that matters is drawn width. A shorter line of Japanese or emoji can be wider than a longer ASCII line, even in a monospaced font, because those glyphs take two cells or more. Tabs have the same problem. The hidden sizer would then be too narrow. The LazyVStack would grow the column when the real widest row is first built, and the scroll extent would jump, which is what the sizer is meant to prevent. Your test line mixes ASCII with Japanese, so it may not have hit this. Consider weighting wide scalars, for example East Asian wide characters and emoji, as 2 when choosing the sizer.

Merged as 590842f