Repository navigation
fix(desktop): Remove unnecessary terminal refresh on window focus - #835
Conversation
Remove aggressive refresh logic that ran on every window focus event: - Removed xterm.refresh(0, xterm.rows - 1) full repaint - Removed clearTextureAtlas() call - Removed window focus event listener Previously, every window focus triggered a full terminal repaint for ALL terminal panes, which could cause visual glitches during rapid terminal updates (e.g., zsh autosuggestions). Now only visibilitychange handler remains to sync dimensions when returning from background (in case window was resized while minimized).
📝 WalkthroughWalkthroughReplaced a complex debounce-based WebGL atlas refresh mechanism triggered on window focus with a simpler visibilitychange event handler. The new flow calls fitAddon.fit() and conditionally updates PTY size if terminal dimensions changed. Removed focus event listener, texture atlas clearing, and explicit refresh logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
xterm.refresh(0, xterm.rows - 1)full repaint callclearTextureAtlas()callwindow.focusevent listenerPreviously, every window focus triggered a full terminal repaint for ALL terminal panes. This was originally added to fix WebGL texture atlas corruption, but was overly aggressive - the WebGL addon already handles actual context loss via
onContextLoss.Now only
visibilitychangehandler remains to sync dimensions when returning from background (in case window was resized while minimized).Test plan
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.