fix(core): invalidate overlay layers and reset screen state on resize#1914
fix(core): invalidate overlay layers and reset screen state on resize#1914ionfwsrijan wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Resize State Reset Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/terminal/LayerManager.test.ts`:
- Around line 331-343: The resize composition test in LayerManager.test.ts is
using require() to construct Screen even though the file runs as ESM, so replace
that usage with the already imported Screen symbol in the composite test. Keep
the rest of the resize assertions intact and ensure the test instantiates Screen
directly before calling lm.composite(screen).
In `@packages/core/src/terminal/Screen.test.ts`:
- Around line 73-93: The resize test in Screen.test is not actually seeding the
saved-line caches, so it can pass even if Screen.resize stops clearing them.
Update the Screen resize test by populating the back buffer, invoking
saveLines(), and then asserting that both getPreviousLine(0) and
getPreviousStyleLine(0) are empty after resize; keep the existing checks around
resize, activeClip, and the Screen state helpers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a61e2b1f-88c5-4576-a6f3-6c951998dea0
📒 Files selected for processing (4)
packages/core/src/terminal/LayerManager.test.tspackages/core/src/terminal/LayerManager.tspackages/core/src/terminal/Screen.test.tspackages/core/src/terminal/Screen.ts
|
@Karanjot786 Please review this |
Description
Two coordinated bugs caused overlay content (modals, dropdowns, toasts) to permanently disappear after terminal resize:
Fix 1:
LayerManager.resize()— Invalidate all layersChanged
dirtyRegion = nulltodirtyRegion = { x: 0, y: 0, width: cols, height: rows }so every layer is fully recomposited after resize (LayerManager.ts:258-261).Fix 2:
Screen.resize()— Reset all ancillary stateAdded reset of
_previousStyleLines,_clipStack,_translateYStack,_translateY,_ansiQueue,_flushEpoch,_swapping, and_backdropFiltersto prevent stale state from causing clipping/translation/swap errors after resize (Screen.ts:433-446).Tests
LayerManager.test.tsto verifydirtyRegioncovers the full new dimensions after resize and that compositing works post-resize.Screen.test.tstest verifying all ancillary state is reset after resize.Closes #1911
Summary by CodeRabbit