fix: Windows terminal input not working#1
Open
toyuvalo wants to merge 8 commits intolevkropp:mainfrom
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 afterfitAddon.fit(), and add aclickevent listener that re-focuses the terminal when clicked.2. Shell fallback defaults to
/bin/bashon Windows (main.js)process.env.SHELLis not set on Windows, so the fallbackprocess.env.SHELL || '/bin/bash'tries to spawn/bin/bash— which doesn't exist. This means if Claude exits and the terminal attempts to restart,ptyProcessends up broken and all further input is silently dropped.Fix: Add a
DEFAULT_SHELLconstant that resolves toprocess.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-ptydefaults 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: falseinpty.spawn()options when running on Windows.Changes
renderer.js:term.focus()+ click-to-focus for both terminal instancesmain.js:DEFAULT_SHELLconstant,useConpty: falseon win32, consistent restart logic instartTerminalandrestartTerminal🤖 Generated with Claude Code