feat(desktop): 集成终端现代化#54
Conversation
将 Shell 标签内嵌终端逻辑迁入 workspace-xterm 模块,并添加 @xterm/addon-webgl 与 @xterm/addon-web-links 供后续 Phase 使用。
加载 @xterm/addon-webgl,调整字号与行高以减少块字符缝隙, WebGL 初始化失败或 context loss 时回退默认渲染器。
通过 CSS 变量映射 VS Code 默认 ANSI 调色板,并在切换 .dark 时 同步更新所有存活 xterm 实例主题。
接入 WebLinksAddon 与 linkHandler,仅 http/https 经 openExternalUrl 打开,并为主题链接添加手型光标样式。
补充 @xterm/addon-webgl 与 @xterm/addon-web-links 许可信息; 全量 build 通过,集成终端现代化五阶段已落地。
缩放 debounce、跳过无效尺寸、WebGL 纹理刷新,PTY 经 onResize 同步; 侧栏连续拖拽期间暂停 fit 以防花屏。Windows 默认 pwsh,优先 ConPTY。
略缩小默认 fontSize,提升同屏信息密度。
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 654d5c6. Configure here.
| sessionScheduleFitRef.current = null; | ||
| }; | ||
| }, [trimmed, canEmbed, retryNonce]); | ||
| }, [trimmed, canEmbed, retryNonce, t]); |
There was a problem hiding this comment.
Adding t to effect deps kills terminal on language change
High Severity
The t function from useTranslation() was added to the useEffect dependency array. In react-i18next v17, t changes reference when the language changes. This causes the entire terminal session — including the running shell process — to be destroyed and recreated whenever the user switches language, losing all terminal history. The previous code intentionally omitted t. The fix is to capture t in a ref (like onTitleChangeRef) and reference that inside the shellExitedMessage closure, keeping t out of the dependency array.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 654d5c6. Configure here.
将 i18n 的 t 存入 ref,避免 useEffect 因 t 引用变化而销毁 PTY。


Summary
@xterm/xterm官方栈抽离workspace-xterm工厂,接入 WebGL 渲染、完整 ANSI 色板(随明暗主题同步)与 Ctrl/Cmd+单击 / OSC 8 超链接。onResize与 PTY 同步;侧栏连续拖拽期间暂停 fit。