[BUG]
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?
Bug Report: Numeric Keypad Inputs Display as Escape Sequences in Claude Code Terminal
Summary
Numeric keypad keys display as raw escape sequences (e.g., [57402u, [57403u, [57407u) instead of digits in Claude Code's integrated terminal. This issue only occurs in Claude Code - the same setup works correctly in iTerm2.
Environment
- Claude Code Version: [Your version - check Help → About]
- OS: macOS (Darwin 24.6.0)
- Terminal Emulator: iTerm2 (primary terminal)
- Shell: zsh
- tmux Version: 3.5a
- TERM: xterm-256color (likely)
Steps to Reproduce
- Open Claude Code
- Open integrated terminal
- Press any numeric keypad key (0-9, Enter, +, -, *, /)
- Observe raw escape sequences appear instead of the expected character
Expected Behavior
Numeric keypad should input digits (0-9) and operators (+, -, *, /, Enter) just like the top row number keys.
Actual Behavior
Numeric keypad keys output raw CSI u format escape sequences:
[57402u[57403u[57407u
These appear to be modern keyboard protocol keycodes (CSI u format) that Claude Code's terminal is not interpreting.
Important Context
This ONLY happens in Claude Code's terminal. The exact same setup works perfectly in:
- iTerm2 (native terminal)
- tmux within iTerm2
- Other terminal applications
This confirms the issue is specific to Claude Code's terminal implementation, not:
- macOS keyboard settings
- iTerm2 configuration
- tmux configuration
- Shell configuration
Attempted Fixes (None Worked)
I have tried all the following without success:
1. Terminal State Resets
printf '\033[?1000l\033[?1003l\033[?1006l' # Disable mouse tracking
printf '\033>' # Exit keypad application mode
reset # Full terminal reset
tput rmkx # Remove keypad mode
2. iTerm2 Settings
- Disabled "Allow application keypad mode"
- Disabled "Use Kitty keyboard protocol"
- Disabled "Report modifiers using CSI u"
- Restarted Claude Code after each change
3. tmux Configuration
# Added to ~/.tmux.conf:
set -g extended-keys off
set -g terminal-overrides ',*:rmkx'
4. Environment Variables
export TERM=xterm-256color
None of these fixes resolved the issue in Claude Code, despite some being effective for similar issues in other terminals.
Technical Analysis
The escape sequences [57402u, [57403u, [57407u are:
- Format: CSI u (modern keyboard protocol)
- Standard: Part of the Kitty keyboard protocol / extended key reporting
- Purpose: Provide unambiguous key identification with modifiers
These sequences suggest:
- iTerm2 is sending modern keyboard protocol codes
- Claude Code's terminal is receiving them
- Claude Code is not interpreting them, just displaying raw bytes
- Other terminals (iTerm2) correctly interpret these sequences
Comparison with Similar Issues
This appears related to:
- Issue #2115 - Escape sequence handling for Konsole
- Issue #5196 - Terminal input handling on macOS
However, this is numeric keypad specific and cannot be resolved with the workarounds that fixed those issues.
Impact
Severity: Medium
- Numeric keypad is unusable in Claude Code terminal
- Workaround: Use top row number keys
- Does not affect Claude Code's main functionality
- Reduces productivity for users who rely on numeric keypad
Requested Fix
Claude Code's terminal should:
- Detect and interpret CSI u format escape sequences
- Map numeric keypad sequences to their corresponding digits/operators
- Maintain compatibility with modern keyboard protocols
Alternatively:
- Provide a setting to disable modern keyboard protocol in Claude Code's terminal
- Document how to configure terminal keyboard handling
Additional Information
I'm happy to:
- Provide additional debugging output
- Test patches or fixes
- Provide my full iTerm2/tmux configuration if helpful
Thank you for investigating this issue!
What Should Happen?
I should be able to use numbers on number keypad
Error Messages/Logs
❯ [57400u[57402u
Steps to Reproduce
iterm
claude
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.4
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗