mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 15:19:16 +00:00
Heavy full-screen TUIs (claude code / gemini cli / opencode), font changes, and device pixel ratio changes can leave xterm.js's WebGL glyph texture atlas in a corrupted state that persists for the life of the terminal — users see persistent "garbled / 花屏" output that only clears when a brand-new terminal is opened (most often on Windows with display scaling / multi-monitor setups). Clear the texture atlas so glyphs re-rasterize at the correct scale instead of forcing users to reopen the terminal: - Add watchDevicePixelRatio() helper (TDD, unit-tested) that re-registers a matchMedia listener across DPI changes and fires a repair callback. - Wire it into createXTermRuntime: on devicePixelRatio change, clear the atlas and refit; also clear the atlas on reflow (term.onResize). Watcher is torn down on dispose. - Expose clearTextureAtlas() on XTermRuntime and call it after font changes in Terminal.tsx (xterm.js #3280). All calls are no-ops under the DOM renderer. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>