fix(core): reset _previousLines on Screen.resize() to prevent stale diff renderer state after terminal resize#690
Conversation
…iff renderer state after terminal resize Closes Karanjot786#681
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR fixes a bug in the terminal screen resize logic. When the terminal is resized, the ChangesScreen Resize Diff Cache Invalidation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🎉 Thanks for your first PR to TermUI, @ionfwsrijan.
Before your PR merges:
- ⭐ Star the repo. Required. The
star-checkjob blocks your merge otherwise. - ✅ All checks green:
build,test,typecheck. - 🏷 PR title follows
type: short description. Example:fix: handle empty list. - 🔗 Link your closing issue in the description.
GSSoC 2026 points come from labels after merge:
gssoc:approved. +50 base points.level:beginner/intermediate/advanced/critical. +20 / +35 / +55 / +80.quality:clean/exceptional. x 1.2 / x 1.5.type:*. Stackable bonus.
Your reviewer responds within 48 hours. Ping @Karanjot786 on Discord for urgent help.
🚀 Welcome to the cohort.
|
@Karanjot786 You may review and merge |
|
Thank you so much for your contribution, @ionfwsrijan! Your PR #690 fixed Screen.resize() to reset _previousLines. The diff renderer no longer shows stale output after a terminal resize. Keep contributing. We appreciate your work. |
Description
When the terminal is resized,
Screen.resize()creates fresh front/back grids but leaves_previousLines(the diff renderer's line cache) untouched. After a resize making the terminal smaller, stale content from the pre-resize grid remains in_previousLines, causing the diff renderer to skip rows whose current content happens to match the stale cached strings.Root Cause
The
resize()method recreated the front/back buffers but did not clear_previousLines.Fix
Added
this._previousLines = [];at the end ofresize()to force a full re-render after terminal resize.Changes
packages/core/src/terminal/Screen.ts:306— reset_previousLineson resizeCloses #681
Summary by CodeRabbit