Repository navigation
markdown: an inline render no longer shrinks for a frame as it changes - #454
Merged
Merged
Conversation
`renderTopLevel` pinned a block's emitted height to the height table even with no viewport, where every block is laid out every frame and a pin has nothing to hide. Each edit re-parses, which leaves the edited block with its estimate (biased low) or the deferred height its first frame filed, and the next frame's pin emitted that in place of its real height. Pins now apply only to a virtualized render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A chat streaming a reply in (fizzyedit/chat) jittered: the conversation dropped by a line
and came back, many times a turn. The cause is in the markdown service's inline render
(
drawInline, which a chat bubble uses).renderTopLevelpins a block's emitted height to its height-table entry. That keeps avirtualized preview still while blocks come back from spacers.
drawInlinepasses noviewport, so nothing is virtualized and every block is laid out every frame, but the pin
still applied. A streamed reply changes its text on every chunk, and the chat's type-in
changes it on every frame. Each change re-parses, which clears the table:
layout is new (a paragraph that just started), the measurement is filed
.deferred,which keeps the estimate.
.deferred), so the pin emits the estimate, which is aline or so short.
The caller sees H, then H minus a line, then H. With the chat following the bottom, the whole
conversation moved down by that line and back.
The fix gates both pins on
virtualize, so a render with no viewport emits what it lays out.The preview pane, which always has a viewport, is unchanged.
How it was seen: fizzy from main (Debug, macOS) in a sandbox profile, with this markdown dylib
in place of the bundled one. A temporary driver in the chat plugin streamed 8 scripted turns,
in 4 to 40 byte chunks every 20 to 140 ms. A per-frame log recorded each message row's rect,
min size and the scroll position.
Example, one reply's row height across three frames with the same text: 98.1, then 80.0, then
98.1 before; 98.1 throughout after.
Test: the headless integration test's inline-render check now streams a reply in 9 bytes a
frame and fails if the height ever drops. Without the fix it fails ("shrank from 36.4 to
19.6 at byte 18"); with it,
zig build test-integrationpasses 53/53 steps, and so dozig build testandscripts/check-fmt.sh.check-web,test-sdk-versionand the fullapp build were left to CI: no SDK or build file changes.
No plan step; a fix found while measuring the chat. The chat's own resize fixes are
fizzyedit/chat#14 and don't depend on this.
🤖 Generated with Claude Code