diff options
| author | haoyuren <13851610112@163.com> | 2026-03-13 22:35:05 -0500 |
|---|---|---|
| committer | haoyuren <13851610112@163.com> | 2026-03-13 22:35:05 -0500 |
| commit | 2ee6d867bd93bb955429a274865320dfa5bd0f69 (patch) | |
| tree | 8f26c196130f7bb083d859007a9aa874ba5eaa21 /src/main | |
| parent | b3b882c541bc719afefa34c5016df03412f279f4 (diff) | |
- Add missing PTY environment variables (TERM, COLORTERM, LANG, TERM_PROGRAM)
- Strip DEC 2026 synchronized output sequences that cause xterm.js to buffer
indefinitely when begin/end markers are split across PTY chunks
- Enable xterm.js windowOptions for terminal pixel/char size queries that
Claude Code sends to determine rendering capabilities
- Launch Claude tab via login shell for full PATH inheritance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/index.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/index.ts b/src/main/index.ts index d4d9b2d..96a225c 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -100,18 +100,28 @@ ipcMain.handle('pty:spawn', async (_e, id: string, cwd: string, cmd?: string, ar const shellPath = cmd || process.env.SHELL || '/bin/zsh' const shellArgs = args || ['-l'] + const ptyEnv: Record<string, string> = { + ...(process.env as Record<string, string>), + TERM: 'xterm-256color', + COLORTERM: 'truecolor', + TERM_PROGRAM: 'LatteX', + LANG: process.env.LANG || 'en_US.UTF-8', + } const instance = pty.spawn(shellPath, shellArgs, { name: 'xterm-256color', cols: 80, rows: 24, cwd, - env: process.env as Record<string, string> + env: ptyEnv }) ptyInstances.set(id, instance) instance.onData((data) => { - sendToRenderer(`pty:data:${id}`, data) + // Strip DEC 2026 synchronized output sequences — xterm.js may buffer indefinitely + // if the begin/end markers are split across PTY chunks + const cleaned = data.replace(/\x1b\[\?2026[hl]/g, '') + if (cleaned) sendToRenderer(`pty:data:${id}`, cleaned) }) instance.onExit(() => { |
