Skip to content

fix: Windows terminal input not working#1

Open
toyuvalo wants to merge 8 commits intolevkropp:mainfrom
toyuvalo:fix/windows-terminal-input
Open

fix: Windows terminal input not working#1
toyuvalo wants to merge 8 commits intolevkropp:mainfrom
toyuvalo:fix/windows-terminal-input

Conversation

@toyuvalo
Copy link
Copy Markdown

Problem

On Windows, the ClawSCAD terminal renders correctly but typing has no effect. Works fine on Linux.

Root causes

1. Missing term.focus() in renderer.js (primary cause)

Electron on Windows does not automatically give keyboard focus to an xterm.js terminal element after term.open(). As a result, term.onData() never fires for keystrokes — every character typed is silently dropped. On Linux, focus is granted automatically.

Fix: Call term.focus() immediately after fitAddon.fit(), and add a click event listener that re-focuses the terminal when clicked.

2. Shell fallback defaults to /bin/bash on Windows (main.js)

process.env.SHELL is not set on Windows, so the fallback process.env.SHELL || '/bin/bash' tries to spawn /bin/bash — which doesn't exist. This means if Claude exits and the terminal attempts to restart, ptyProcess ends up broken and all further input is silently dropped.

Fix: Add a DEFAULT_SHELL constant that resolves to process.env.COMSPEC || 'cmd.exe' on Windows, and use it everywhere in place of the old fallback.

3. ConPTY input reliability on Windows (main.js)

node-pty defaults to the ConPTY backend on Windows, which can silently fail to forward input for some CLI applications. The legacy winpty backend is more reliable.

Fix: Pass useConpty: false in pty.spawn() options when running on Windows.

Changes

  • renderer.js: term.focus() + click-to-focus for both terminal instances
  • main.js: DEFAULT_SHELL constant, useConpty: false on win32, consistent restart logic in startTerminal and restartTerminal

🤖 Generated with Claude Code

toyuvalo and others added 8 commits March 17, 2026 16:40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ngful changes

The contributor's npm install regenerated the entire lockfile and reformatted
package.json, causing ~12k lines of noise. This keeps only the 3 real changes:
- postinstall script → node scripts/postinstall.js
- node-pty ^1.0.0 → ^1.1.0
- scripts/**/* added to build files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants