We Fixed Anthropic's Backspace Bug Before They Did
🐛 The bug: Claude Code v2.1.113 reversed Backspace and Ctrl+Backspace on Windows — pressing Backspace deletes entire words
🔍 The cause: Byte mappings
0x7f and 0x08 are swapped in the input handler🔧 The fix: Two lines in Windows Terminal settings swap them back — copy-paste solution below
- BYTES
- 0x65 0x65
- ACTION
- TYPE
The Problem
You're typing a prompt in Claude Code on Windows Terminal. You make a typo. You press Backspace.
The entire word vanishes. Not one letter. The whole word.
Think of it like a door with the push/pull sign on the wrong side. The door works fine — but the instructions are backwards. Every person who walks up to it gets it wrong on the first try.
This started in Claude Code v2.1.113, which added Ctrl+Backspace as a word-delete shortcut on Windows. The feature works — but the key mappings are reversed.
The Investigation
We started where everyone starts: blaming the terminal. Windows Terminal uses ConPTY (a pseudo-terminal layer), and it has a history of mangling escape sequences. Seemed like the obvious culprit.
We tried everything at the terminal level:
sendInput keybinding
↓
❌ Didn't work
↓
⚙️ Enable
experimental.connection.passthroughMode
↓
❌ Didn't work
↓
📦 Wrap Claude in
winpty
↓
❌ Didn't work
↓
🏭 Compile a C# wrapper to disable
ENABLE_VIRTUAL_TERMINAL_INPUT
↓
❌ Didn't work
↓
💡 Wait — what if the terminal isn't the problem?
The Breakthrough
We wrote a tiny Node.js script that captures raw bytes from stdin:
const fs = require("fs");
process.stdin.setRawMode(true);
process.stdin.resume();
let count = 0;
console.log("Press BACKSPACE, then CTRL+BACKSPACE:");
process.stdin.on("data", (data) => {
count++;
const label = count === 1 ? "BACKSPACE" : "CTRL+BACKSPACE";
const bytes = [...data].map(b => "0x" + b.toString(16).padStart(2, "0"));
console.log(`${label}: ${bytes.join(" ")}`);
if (count >= 2) process.exit();
});
Opened a new Windows Terminal tab, ran it, and pressed both keys. The results:
BACKSPACE: 0x7f (1 byte, decimal 127)
CTRL+BACKSPACE: 0x08 (1 byte, decimal 8)
Both correct. 0x7f is the standard Unix backspace. 0x08 is the standard Ctrl+Backspace. The terminal was doing its job perfectly.
The terminal was sending the right signal the entire time. The bug was inside Claude Code itself.
We ran the test again for both keys. Here's what the terminal sends vs what Claude Code does with it:
| Key | Byte Sent | What Claude Code Does | What It Should Do |
|---|---|---|---|
| Backspace | 0x7f (DEL) | Deletes entire word | Delete one character |
| Ctrl+Backspace | 0x08 (BS) | Deletes one character | Delete entire word |
The mappings are exactly reversed. Claude Code reads 0x7f and thinks "delete word." It reads 0x08 and thinks "delete character." Backwards.
Why It Only Hits Windows Terminal
Claude Code is built on Bun (not Node.js). Bun has a documented history of backspace bugs on Windows — specifically around the ENABLE_VIRTUAL_TERMINAL_INPUT console flag and how it interacts with ConPTY.
Terminals like mintty use a completely different PTY implementation (cygwin PTY), so the byte handling follows a different code path in Bun. Windows Terminal + ConPTY hits the broken one.
0x7f through the layersmintty (Git Bash native)
Uses cygwin PTY. Bun handles the bytes correctly through a different code path. Backspace works.
Windows Terminal
Uses ConPTY. Bun's input handler maps the two backspace bytes to the wrong actions. Reversed.
The Fix
Since we can't patch Claude Code's binary, we fix it at the terminal level. We tell Windows Terminal to swap the bytes before they reach Claude Code — counteracting the reversal.
Open your Windows Terminal settings JSON (press Ctrl+Shift+, inside Windows Terminal). Add these to the "actions" array:
{
"command": { "action": "sendInput", "input": "\b" },
"id": "User.sendInput.BackspaceAsSingleDelete",
"keys": "backspace"
},
{
"command": { "action": "sendInput", "input": "" },
"id": "User.sendInput.CtrlBackspaceAsWordDelete",
"keys": "ctrl+backspace"
}
Restart Windows Terminal. Backspace now deletes one character. Ctrl+Backspace deletes a word. The way it should be.
Do
Remove this workaround when Anthropic fixes bug #51841. Otherwise the keys will be double-reversed.
Don't
Blame Windows Terminal. The terminal sends the correct bytes. The bug is in Claude Code's input handler.
Let Claude Fix It For You
Paste this prompt into Claude Code and it will apply the fix automatically:
Backspace deletes entire words instead of single characters
in Windows Terminal. This is a known bug (#51841) where
Claude Code v2.1.113 reversed the byte mappings. Fix it by
adding two sendInput actions to my Windows Terminal
settings.json that swap the bytes: map Backspace to send \b
(0x08) and Ctrl+Backspace to send the DEL character 0x7f.
Open the settings file from within Windows Terminal using
Ctrl+Shift+, to find the correct path.
The Timeline
Here's how it played out, start to finish:
↓
🔍 Try 5 different terminal-level fixes — all fail
↓
📊 Capture raw stdin bytes — terminal sends correct
0x7f
↓
🧬 Trace to Bun runtime's ConPTY handling and Claude Code's input mapper
↓
🔎 Find exact GitHub issue #51841 — confirmed, 0 comments, no fix
↓
💡 Capture both Backspace (
0x7f) and Ctrl+Backspace (0x08) — confirmed reversed
↓
🔧 Build the swap fix in Windows Terminal settings
↓
✅ Post the fix to the GitHub issue — first and only workaround
The Bigger Picture
This wasn't a complex fix. It was two lines of JSON. But finding those two lines meant ruling out every other possibility first — ConPTY passthrough, winpty wrappers, C# console flag overrides, Bun runtime patches.
Debugging is mostly about proving what isn't the problem. The fix took 10 seconds to write. The investigation took hours. That's normal.
We posted the full diagnostic and workaround to GitHub issue #51841. At the time of writing, it's the only comment with a working fix.
Visuals created with one-shot-scripts v3.7.0
Tools That Fix Themselves
Godmode skills for Claude Code — execution protocols, evolution engines, and the AI tools we used to debug this.
See Pricing Read More Posts