Repository navigation
fix(core): add missing requestRender() in CodeRenderable streaming content setter - #965
Merged
simonklee merged 1 commit intoApr 23, 2026
Conversation
altendky
requested review from
Hona,
kommander,
msmps and
simonklee
as code owners
April 22, 2026 19:55
simonklee
approved these changes
Apr 23, 2026
m-pa
pushed a commit
to m-pa/opentui
that referenced
this pull request
Apr 27, 2026
…ntent setter (anomalyco#965) Fixes anomalyco#963 ## Summary When streaming content into a `CodeRenderable` with `_drawUnstyledText=false` and an active `_filetype`, the `content` setter was returning early without calling `requestRender()`. If the renderer was otherwise idle (no animations, no input), no frame was ever scheduled, so `renderSelf()` never ran, `startHighlight()` never started, and the display stayed stale indefinitely. ## Root Cause The streaming optimization in the `content` setter: ```ts if (this._streaming && !this._drawUnstyledText && this._filetype) { return // no requestRender() } ``` Stored the new content and marked highlights dirty, but never scheduled a render frame. ## Fix Added `this.requestRender()` before the early return: ```ts if (this._streaming && !this._drawUnstyledText && this._filetype) { this.requestRender() return } ``` ## Test Added `packages/core/src/renderables/__tests__/Code.test.ts` with a test that verifies: 1. Setting content in streaming mode schedules a render 2. The subsequent render triggers `startHighlight()` (asserted via `isHighlighting` and mock client state) ## Verification - New test: **1 pass** - Existing `LineNumberRenderable` tests (which exercise `CodeRenderable`): **29 pass, 0 fail**
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.
Fixes #963
Summary
When streaming content into a
CodeRenderablewith_drawUnstyledText=falseand an active_filetype, thecontentsetter was returning early without callingrequestRender(). If the renderer was otherwise idle (no animations, no input), no frame was ever scheduled, sorenderSelf()never ran,startHighlight()never started, and the display stayed stale indefinitely.Root Cause
The streaming optimization in the
contentsetter:Stored the new content and marked highlights dirty, but never scheduled a render frame.
Fix
Added
this.requestRender()before the early return:Test
Added
packages/core/src/renderables/__tests__/Code.test.tswith a test that verifies:startHighlight()(asserted viaisHighlightingand mock client state)Verification
LineNumberRenderabletests (which exerciseCodeRenderable): 29 pass, 0 fail