Repository navigation
core: lay out Markdown lists once every changed block shows - #2199
Merged
Merged
Conversation
A block shown again in a new default (a list a renderer shows again, a fence a code-block renderer takes over, or an item's paragraph that becomes a table) showed its descendants and laid out their lists at once, in the middle of the change. Blocks the change added later were not shown yet, so a list that counted its items read one that was missing and threw "undefined is not an object (evaluating 'shown.ordinal = count++')". Showing descendants now adds their tables and lists to the caller's refresh, which runs after the change has shown every block; a style change runs the same refresh. The added show() parameter replaces the local refresh in showDescendants and restyle's own table and list arrays (source -1 line). Fixes anomalyco/opencode#65766
Dicklesworthstone
pushed a commit
to Dicklesworthstone/opentui
that referenced
this pull request
Nov 23, 2026
…o#2199) OpenCode 2.4.0 users can see the TUI crash with `undefined is not an object (evaluating 'c.ordinal=o++')` while an answer with lists streams in. When a Markdown update showed a block again in a new renderable, the block's lists were laid out at once, before the blocks added later in the same update were shown. A list that counted its items then read an item that was not shown yet and threw. Updates that reach this include a list item whose paragraph becomes a table as the next item arrives, a list a `renderBlock` renderer shows again as a nested item arrives, and a fence that a code block renderer takes over in a list item. OpenTUI 0.9.4 through 0.9.8 have it. Showing a block again now adds its tables and lists to the update's single layout pass, which runs after every block of the update is shown. A style change uses the same pass. The change removes code; it adds no new state. Two rows in an existing Markdown list test stream these updates. Before the fix both throw in the list layout; now they render as a fresh render does. Fixes anomalyco/opencode#65766 (cherry picked from commit e45f43f)
simonklee
added a commit
that referenced
this pull request
Nov 26, 2026
Two models could not reach the Markdown list crash (#2199) or the stale size after resume (#2181). Each now generates the input its bug needed and finds the bug with the fix reverted. Builds on the duplicated code block fix, which the new input found; merge that first. The Markdown model switches `renderBlock` between four renderers, two of which take over code blocks; it finds #2199 at seed 985. P7 and P8 now also skip a line starting with "```" whose info string holds a backtick: CommonMark makes that no fence, so the run may still close as a code span while streaming. The session simulation resizes the terminal while suspended, without a SIGWINCH, and checks the resumed renderer's size; 31 of 170 rows fail without the #2181 fix. CI time grows by about 0.2 s.
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.
OpenCode 2.4.0 users can see the TUI crash with
undefined is not an object (evaluating 'c.ordinal=o++')while an answer with lists streams in.When a Markdown update showed a block again in a new renderable, the block's lists were laid out at once, before the blocks added later in the same update were shown. A list that counted its items then read an item that was not shown yet and threw. Updates that reach this include a list item whose paragraph becomes a table as the next item arrives, a list a
renderBlockrenderer shows again as a nested item arrives, and a fence that a code block renderer takes over in a list item. OpenTUI 0.9.4 through 0.9.8 have it.Showing a block again now adds its tables and lists to the update's single layout pass, which runs after every block of the update is shown. A style change uses the same pass. The change removes code; it adds no new state.
Two rows in an existing Markdown list test stream these updates. Before the fix both throw in the list layout; now they render as a fresh render does.
Fixes anomalyco/opencode#65766