Skip to content

fix(desktop): refresh terminal renderer after reattach - #3506

Closed
dorukardahan wants to merge 1 commit into
ParadevAI:mainfrom
dorukardahan:fix/macos-terminal-webgl-reattach
Closed

dorukardahan wants to merge 1 commit into
ParadevAI:mainfrom
dorukardahan:fix/macos-terminal-webgl-reattach

Conversation

@dorukardahan

@dorukardahan dorukardahan commented Apr 16, 2026 •

Copy link
Copy Markdown

Summary

  • add a shared terminal renderer refresh helper that clears the WebGL texture atlas before repaint
  • call that helper after terminal reattach, resize, font changes, and WebGL context loss
  • use the same recovery path in both terminal lifecycle implementations
  • add a focused unit test for the renderer refresh helper

Why

This keeps the terminal redraw path consistent after a pane was detached, reattached, resized, or occluded on macOS.

The goal is narrow. This PR does not disable WebGL, does not disable ligatures, and does not change renderer selection. It only makes the existing WebGL path refresh from a clean texture atlas before repainting.

Nearby risk: the app has two terminal lifecycle paths. This change updates both so the recovery logic does not drift between them.

Tests

  • bun test apps/desktop/src/renderer/lib/terminal/terminal-renderer.test.ts
  • bun test apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/**/*.test.ts apps/desktop/src/renderer/lib/terminal/terminal-renderer.test.ts apps/desktop/src/renderer/lib/terminal/*.test.ts
  • cd apps/desktop && bun run typecheck

Real-world validation

  • linked from the macOS rendering issue
  • local source inspection matched the shipped app versions involved in the bug report
  • fullscreen still acts as an immediate recovery in the reported broken state, which is consistent with this repaint path

Issue

Fixes #3504


Summary by cubic

Fixes stale or blank terminal frames on macOS by clearing the WebGL texture atlas and forcing a repaint after reattach, resize, font changes, or context loss. Unifies the recovery path across both terminal lifecycles and adds a focused test. Fixes #3504.

  • Bug Fixes
    • Added refreshTerminalRenderer helper that clears the WebGL texture atlas (via @xterm/addon-webgl) and calls a full refresh.
    • Invoked the helper after attach, resize, font updates, and WebGL context loss in both terminal lifecycle paths.
    • Added a unit test for the helper; no change to renderer selection or ligatures.

Written for commit 9c23287. Summary will update on new commits.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b10095af-b224-4bff-9782-affb61fef5c0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dorukardahan

Copy link
Copy Markdown
Author

i am closing this draft to avoid overlap with #3322.

my separate repro is tracked in #3504. if the current repaint recovery work does not fully fix the chat ghosting and fullscreen case on mac, i can send a narrower follow up PR later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] macOS terminal rendering can corrupt and ghost into chat until fullscreen toggle

1 participant