Repository navigation
refresh_lines repaints a widget's lines without rendering its content again - #246
Merged
Merged
Conversation
… again A full refresh() reaches _set_dirty(), which adds the whole widget to _dirty_regions, so render_line rebuilds the content: right for "the content changed", wrong for an animation frame that only tints the same lines in render_line. Toad's arrival fades did exactly that, rebuilding every Markdown block and row of a fading entry each frame (rich Style construction was 19% of the live main thread). refresh_lines() invalidates and repaints every line from the content already rendered; _invalidate_lines is the half _set_dirty already did, now owned once and inherited by both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
1 commit, widget.py +26/-10. A full
refresh()goes through_set_dirty(), which adds the whole widget to_dirty_regions(widget.py:2556), sorender_linerebuilds the content. That's right when the content changed, and wrong for an animation frame that only tints the same lines. Toad's arrival fades rebuilt every Markdown block and row of a fading entry on every frame, and richStyleconstruction was 19% of the live main thread.Widget.refresh_lines()invalidates and repaints every line from the content already rendered, sorender_lineruns again and_render_contentdoesn't._invalidate_lines()is the half_set_dirty()already did (clear the styles cache, mark the lines, add the repaint region). It's now one method both callers use, not a second copy.Proof: a probe in Toad's real app, over one arrival fade, measured content rebuilds of the unchanged entry at 9 in 21 frames before and 1 in 27 frames after (the initial render). Screens, markdown (including fence cache and initial publication), refresh-callback, bindings, containers, data table, text area, option list, tree and animations tests: 639 passed. The 3
test_editor_statereds fail identically on clean main.🤖 Generated with Claude Code