Repository navigation
markdown: a wrapped table keeps its height while the reader scrolls - #298
Merged
Merged
Conversation
foxnne
force-pushed
the
docs/plans-private
branch
from
October 9, 2026 19:44
5a25fb8 to
f304d96
Compare
foxnne
marked this pull request as ready for review
October 10, 2026 01:07
foxnne
enabled auto-merge (squash)
October 10, 2026 01:08
dvui wraps a text layout on its first frame at an assumed 1000pt, so it measures short, and the preview believed those measurements: table cells settled short when budgeted draws were all first frames, rows lagged a frame behind their cells, a pinned block was measured by its pin, and `.measured` meant both "clean at this width" and "stale from a width change". Each is fixed, every block with a believed height is now pinned, and the table sample is a generated document whose cells wrap, on which both scroll tests fail without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne
force-pushed
the
markdown/wrapped-table-heights
branch
from
October 10, 2026 02:51
e552c7a to
005e864
Compare
This was referenced Oct 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
A markdown table whose cells wrap over many lines no longer changes height as the reader scrolls into it. The scrollbar no longer twitches by a line when paragraphs scroll back into view, either. The table-heavy test sample is now a generated document whose tables actually wrap. Both integration tests that guard this failed on it before the fix, and the old frozen plan copy hid the bug.
Why it moved. Everything traces to one dvui behaviour: a text layout on its first frame wraps at an assumed 1000pt, not at the column, so it measures short. The preview's bookkeeping believed those measurements in four places:
provisional) only when there is nothing better..deferredtable came out of deferral with its untrusted height filed as a clean measurement. Now any pinned block is measured by its unconstrained inner box, which only pinned-above-the-fold blocks used to be. That also makes it safe to pin every block with a believed height, not only tables. A paragraph scrolled back into view emitted a line short for a frame. That was the remaining 19.6pt in "rapid scrolling up and down"..measuredmeant two things. It meant both "clean at this width" and "laid out at a width that is gone".recordmust throw the second away for a contaminated measurement, so it threw the first away too. Stale heights are now their own state,.stale.invalidateForWidthalso no longer turns a never-measured.estimatedslot into a "measurement" of its zero placeholder.The task this came from guessed at the table estimate for wrapped cells. Instrumenting the failing block showed the estimate was never involved: the table settled at 1789.1 from a clean off-screen measurement, and the on-screen layout was the one that was wrong.
The sample.
tests/data/markdown_sample_tables.mdis now generated bytests/data/markdown_sample_tables.py(seeded, so it reproduces exactly). It has one 48KB three-column table whose cells wrap over many lines, three smaller tables, and prose. After the tables come blocks that repeat word for word, so source hashes are not unique (the old sample had seven, which the traversal test relies on), and one long paragraph for bench-markdown's "prose" sample. Those come after the tables on purpose: content inserted above them shifted which scroll frames see the big table, and that alone hid the block-heights failure. The frozen plan copy at that path is gone. bench-markdown's "prose" sample now uses this document as well.SDK impact
Verified
zig build,zig build test,zig build test-integration,zig build check-web,zig build test-sdk-version), re-run after rebasing ontomainpast docs: plans move to the private fizzyedit/plans #296.block 29 changed height while scrolling: 1789.1 -> 1730.4, and a rapid-scroll total of 18967.6 against 19476.0. With the fix, all 17markdown previewintegration tests pass.**Row N**variant of the sample also passes all 17 (reported failing with2610.4 -> 2297.5before; I did not re-run that on the parent). So does the old frozen plan copy.block_heights.zig: a contaminated measurement does not replace a clean one at the same width, and a width change leaves a never-measured block on its estimate.test-integrationcheck-webcompiles. Not run in a browser.Not checked by eye in the running app. The evidence is the headless layout tests above.
Follow-ups
.measured, and the pin comes off. That is the lag pinned-above-the-fold blocks already had.🤖 Generated with Claude Code