Skip to content

feat(desktop): 集成终端现代化#54

Merged
N123999 merged 8 commits into
mainfrom
feat/desktop-integrated-terminal-v2
Jun 2, 2026
Merged

feat(desktop): 集成终端现代化#54
N123999 merged 8 commits into
mainfrom
feat/desktop-integrated-terminal-v2

Conversation

@N123999

@N123999 N123999 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 基于 @xterm/xterm 官方栈抽离 workspace-xterm 工厂,接入 WebGL 渲染、完整 ANSI 色板(随明暗主题同步)与 Ctrl/Cmd+单击 / OSC 8 超链接。
  • 修复侧栏缩放导致的终端花屏:防抖 fit、无效尺寸跳过、WebGL 纹理刷新、onResize 与 PTY 同步;侧栏连续拖拽期间暂停 fit。
  • Windows 集成终端默认优先 pwsh,并尝试 ConPTY(失败回退 WinPTY);终端默认字号 12。

N123999 added 7 commits June 2, 2026 16:21
将 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,提升同屏信息密度。
@N123999

N123999 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 654d5c6. Configure here.

将 i18n 的 t 存入 ref,避免 useEffect 因 t 引用变化而销毁 PTY。
@N123999 N123999 merged commit 3890cb2 into main Jun 2, 2026
@N123999 N123999 deleted the feat/desktop-integrated-terminal-v2 branch June 2, 2026 09:02
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.

1 participant