[BUG] Numeric keypad Enter key outputs escape sequence [57414u instead of newline
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?
Numeric keypad Enter key outputs escape sequence [57414u instead of newline
Environment
- OS: macOS (please add your version, e.g., Sonoma 14.x)
- Terminal: iTerm2 (please add version from iTerm2 → About)
- Keyboard: Extended keyboard with numeric keypad
- Claude Code version: (run
claude --version)
Description
When using Claude Code in iTerm2, pressing the Enter key on the numeric keypad outputs the literal characters [57414u instead of executing a return/newline. The Return key on the main keyboard (above right Shift) works correctly.
The issue appears to be related to the CSI u (Kitty keyboard protocol) that Claude Code enables. The sequence 57414 is the Unicode codepoint for the numpad Enter key, suggesting the key press is being encoded in enhanced keyboard mode rather than interpreted as a newline.
Steps to Reproduce
- Open iTerm2
- Launch Claude Code (
claude) - Press the Enter key on the numeric keypad
- Observe
[57414uappended to the input line instead of a newline
Expected Behavior
Numeric keypad Enter should function identically to the main keyboard Return key, sending a newline.
Actual Behavior
Keypad Enter outputs the raw escape sequence [57414u.
Additional Notes
- The main keyboard Return key works fine
- After exiting Claude Code, the keypad Enter continues to malfunction until running
resetorprintf '\e[?u'to disable CSI u mode - This suggests Claude Code may not be fully restoring terminal state on exit
Workarounds
- Use the main keyboard Return key instead of keypad Enter
- Run
resetafter exiting Claude Code to restore terminal state - Add a custom key mapping in iTerm2 (Settings → Profiles → Keys → Key Mappings) to map keypad Enter to send
\n
What Should Happen?
Numeric keypad Enter should function identically to the main keyboard Return key, sending a newline.
Error Messages/Logs
Observe [57414u appended to the input line instead of a newline
Steps to Reproduce
hit enter key on Mac extended keyboard
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.3
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 ↗