[BUG] Escape-Escape clear-line triggers incorrectly when using Escape-Backspace for word deletion
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When quickly deleting multiple words using Escape-Backspace, the Escape-Escape clear-line shortcut triggers incorrectly. The system detects two Escape keys even though there's a Backspace between them, causing the entire input line to be cleared instead of just deleting words.
What Should Happen?
The Escape-Escape detection should only trigger when two Escape keys are pressed consecutively without any intervening keypresses. When using Escape-Backspace multiple times in quick succession (e.g., Escape-Backspace-Escape-Backspace), it should delete two words, not clear the entire line. The Escape detection should reset after any non-Escape keypress.
Error Messages/Logs
Steps to Reproduce
- Type a multi-word command in the Claude Code prompt (e.g., "hello world foo bar")
- Quickly press: Escape-Backspace-Escape-Backspace
- Expected: Deletes "bar" then "foo", leaving "hello world"
- Actual: Entire line is cleared as if Escape-Escape was pressed
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.19 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
Here's what Claude had to say when I asked for ways to mitigate or workaround this:
● Unfortunately, I don't see any configuration options for keyboard shortcuts in Claude Code. The input handling appears to be built into the CLI binary itself, so there's no settings file you can modify to change the Escape-Escape detection timing or behavior. Workarounds you could try: 1. Add a small pause between deletions - If you pause ~200-300ms between word deletions, it should reset the Escape detection. Not ideal, but functional. 2. Use Ctrl+W instead - If you're in a bash-like readline environment, Ctrl+W typically deletes the previous word. However, this depends on your terminal/shell configuration and may not work within Claude Code's prompt. 3. Delete one word at a time and pause briefly - Use Escape-Backspace, wait a beat, then Escape-Backspace again. 4. Use Escape-Escape to clear when needed - Since you know about this behavior now, you could just work with it - use Escape-Backspace for single word deletion and Escape-Escape-Backspace when you want to start fresh. None of these are great solutions, which is why reporting the bug is the right approach. The fix on the developer side would be straightforward - just reset the Escape detection state whenever any non-Escape key is pressed.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗