fix: resolve new tab creation failure and shortcut passthrough

- Fix pty.spawn cwd tilde expansion: ptyManager now passes resolvedCwd (expanding ~ and verifying directory existence) so child processes do not exit immediately on launch
- Add pointer-events: none to SVGs inside buttons and tabs to prevent Electron window-dragging interception
- Extend xterm attachCustomKeyEventHandler to allow Ctrl+Shift+T, Ctrl+Shift+W, etc. through while terminal is focused
- Wrap remote SSH and serial spawns with fallback to local bash to prevent tab death loops on connection failures
This commit is contained in:
2026-09-24 01:48:43 +08:00
parent ebf454a250
commit 4707817053
7 changed files with 85 additions and 13 deletions
+6 -4
View File
@@ -229,9 +229,10 @@ export class WorkspaceManager {
const targetHost = ws.user ? `${ws.user}@${ws.host}` : ws.host;
const portArgs = ws.port && Number(ws.port) !== 22 ? ['-p', String(ws.port)] : [];
const extra = ws.extraArgs ? ws.extraArgs.split(' ').filter(Boolean) : [];
const sshCmd = `ssh ${[...portArgs, ...extra, targetHost].join(' ')}`;
return {
shell: 'ssh',
args: [...portArgs, ...extra, targetHost],
shell: '/bin/bash',
args: ['-c', `${sshCmd} || (echo -e "\\n\\x1b[33m[SSH 会话断开或连接失败,已保留本地交互终端]\\x1b[0m" && exec bash)`],
title: `ssh: ${ws.name || targetHost}`,
};
}
@@ -239,9 +240,10 @@ export class WorkspaceManager {
if (ws.type === WORKSPACE_TYPES.SERIAL) {
const baud = String(ws.baudRate || 115200);
const dev = ws.device || '/dev/ttyUSB0';
const tool = ws.tool || 'picocom';
return {
shell: 'picocom',
args: ['-b', baud, dev],
shell: '/bin/bash',
args: ['-c', `which ${tool} >/dev/null 2>&1 && ${tool} -b ${baud} ${dev} || (echo -e "\\n\\x1b[33m[串口工具 ${tool} 未安装或 ${dev} 无法连接,已保留本地交互终端]\\x1b[0m" && exec bash)`],
title: `serial: ${dev}`,
};
}