diff options
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/main/index.ts | 14 | ||||
| -rw-r--r-- | src/renderer/src/components/Terminal.tsx | 10 |
3 files changed, 21 insertions, 5 deletions
diff --git a/package.json b/package.json index 70a245a..99d5ed7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lattex", - "version": "0.2.2", + "version": "0.2.4", "description": "LaTeX editor with real-time Overleaf sync", "license": "AGPL-3.0", "author": "Yuren Hao", 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(() => { diff --git a/src/renderer/src/components/Terminal.tsx b/src/renderer/src/components/Terminal.tsx index 9a2e24c..72f785f 100644 --- a/src/renderer/src/components/Terminal.tsx +++ b/src/renderer/src/components/Terminal.tsx @@ -53,7 +53,13 @@ function TerminalInstance({ id, cwd, cmd, args, visible }: { fontFamily: '"SF Mono", "Fira Code", "JetBrains Mono", monospace', fontSize: 13, cursorBlink: true, - scrollback: 10000 + scrollback: 10000, + windowOptions: { + getWinSizePixels: true, + getCellSizePixels: true, + getWinSizeChars: true, + getWinPosition: true, + } }) const fitAddon = new FitAddon() @@ -149,7 +155,7 @@ export default function Terminal() { <TerminalInstance id="terminal" cwd={syncDir} visible={mode === 'terminal'} /> {claudeSpawned && ( - <TerminalInstance id="claude" cwd={syncDir} cmd="claude" args={[]} visible={mode === 'claude'} /> + <TerminalInstance id="claude" cwd={syncDir} args={['-l', '-c', 'claude']} visible={mode === 'claude'} /> )} </div> ) |
