Input corruption: first keystrokes at a fresh prompt scrambled in VS Code integrated terminal (Windows)
Summary
Typing at a fresh Claude Code prompt inside the VS Code integrated terminal on Windows corrupts the first 1-2 keystrokes (phantom space/backspace or character reorder). After the first characters, the rest of the line is clean. Does not happen in standalone Windows Terminal / PowerShell.
Repro
- Run
claudein the VS Code integrated terminal (PowerShell) on Windows. - At a fresh prompt, type a short sentence at normal speed, e.g.
Did not fix it. - The first characters scramble:
Didrenders asD id(phantom space after the first char). Another observed case:I did->DI did.
Expected
Text appears exactly as typed.
Actual
First 1-2 characters are reordered / gain a phantom space or backspace; the remainder of the line is correct.
Environment
- Claude Code: 2.1.195
- VS Code: 1.122.1
- OS: Windows 10 (19045)
- Shell: PowerShell (pwsh)
Already tried (no effect)
terminal.integrated.windowsUseConptyDll: bothtrueandfalseeditor.accessibilitySupport:off(status bar had shown "Screen Reader Optimized")terminal.integrated.localEchoEnabled:offterminal.integrated.shellIntegration.enabled:falseterminal.integrated.gpuAcceleration:offandauto
Notes / suspected cause
Clean in standalone Windows Terminal, broken only in the VS Code integrated terminal, and only for the first keystrokes at prompt-start. This is consistent with the TUI's terminal query at prompt-draw (cursor-position / device-attributes request) having its reply injected into the input stream and colliding with the user's first keystrokes, with VS Code's xterm.js reply timing differing from a native Windows console.
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
👎
Still reproduces on 2.1.210, three releases after this was filed. I can also add a second affected host: Cursor 3.11.19, a VS Code fork. It uses the same xterm.js-based integrated terminal, which I think strengthens the CPR-collision hypothesis in the original report rather than pointing at anything specific to VS Code itself.
Environment
anthropic.claude-code-2.1.210-win32-x64)One detail that "scrambled" may not capture: in my case the stray first character is undeletable — backspace will not remove it. That reads as the reply to the prompt-draw cursor-position query (
ESC[6n→ESC[row;colR) landing in the buffer as something the line editor doesn't treat as user-typed text, rather than as a reordering of the user's own keystrokes. Mentioning it in case it helps narrow down where the reply is (or isn't) being consumed.For what it's worth, nothing in the 2.1.207–2.1.210 changelogs appears to touch this, and the VS Code settings listed in the original report have no effect here either.
Confirming the same corruption on a different machine, and on a newer build than the OP:
Symptoms match the OP: the first 1-2 keystrokes at a fresh prompt scramble, e.g. typing
feedbackrenders asf eedback(phantom space after the first character). The first character also appears stuck on the display - trying to backspace over it deletes a different character, so the visible line and the input buffer disagree about position.One additional symptom not in the OP: sometimes the prompt stops responding to typing entirely, and only recovers after cycling through a slash command (e.g.
/usage, dismiss the dialog). That feels consistent with the suspected cause in the OP notes - a terminal query reply colliding with the input stream and leaving the input state machine mid-sequence until something forces a redraw.