perf: add DrawOver and HardScroll for incremental scroll rendering - #130
Open
luispabon wants to merge 2 commits into
Open
perf: add DrawOver and HardScroll for incremental scroll rendering#130luispabon wants to merge 2 commits into
luispabon wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
==========================================
- Coverage 60.14% 60.10% -0.04%
==========================================
Files 52 52
Lines 6696 6708 +12
==========================================
+ Hits 4027 4032 +5
- Misses 2393 2400 +7
Partials 276 276 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
DrawOver renders content without pre-clearing the area, allowing SetCell's equality check to mark only genuinely-changed cells as touched. Enables incremental cell buffer updates in bubbletea's cursed_renderer for scroll-optimized rendering.
luispabon
force-pushed
the
perf/scroll-optimization-clean
branch
from
July 3, 2026 09:23
6721564 to
cb3b3a9
Compare
Author
|
Rebased |
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.
Closes #129
Summary
Adds two public APIs to support incremental scroll rendering in bubbletea v2:
StyledString.DrawOver(buf, area)— renders without pre-clearing, enablingtouched-line tracking via SetCell equality check
TerminalRenderer.HardScroll(newbuf, n, top, bot)— directly emits terminalscroll sequences via existing
scrollnand skipsscrollOptimizeon next RenderChanges
styled.go: newDrawOvermethod (mirrorsDrawminus the clear loop)styled_drawover_test.go: output equivalence + incremental touch teststerminal_renderer.go:skipScrollOptimfield + guard inRender()terminal_renderer_hardscroll.go: publicHardScrollmethodMotivation
bubbletea v2's cursedRenderer scroll frames cost ~800µs vs v1's ~100µs. The
bottleneck is redundant work: full ANSI reparse + O(width×height) hashmap
re-detection of scrolls that the caller already knows about. These APIs let
the caller bypass both.
Companion bubbletea PR: charmbracelet/bubbletea#XX