[BUG] Numpad Enter key not recognized in Ghostty terminal (CSI u sequence 57414)
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 running Claude Code in Ghostty terminal, pressing the numpad Enter key inserts the literal characters [57414u instead of submitting input. The regular Enter key works correctly.
This happens because Ghostty implements the Kitty keyboard protocol. When Claude Code requests enhanced keyboard mode, Ghostty encodes the numpad Enter key as the CSI u sequence ^[[57414u (where 57414 is the Unicode codepoint for KP_Enter). Claude Code does not recognize this sequence and passes it through as literal text.
Environment:
- OS: macOS (Darwin 25.2.0)
- Terminal: Ghostty
- Claude Code version: 2.1.5
What Should Happen?
The numpad Enter key should submit the input, identical to the main Enter key.
Claude Code's input handling should recognize the CSI u sequence for KP_Enter (keycode 57414) and treat it as equivalent to the regular Enter key.
Error Messages/Logs
No error message. The literal characters `[57414u` appear in the input field when the numpad Enter key is pressed.
Example: typing "echo hello" and pressing numpad Enter results in:
echo hello[57414u
Steps to Reproduce
- Install Ghostty terminal on macOS
- Open Ghostty terminal
- Run
claudeto start Claude Code - Type any text (e.g., "hello")
- Press the numpad Enter key (the Enter key on the numeric keypad, not the main Enter key above right Shift)
- Observe that
[57414uis inserted instead of submitting the input
Note: The same numpad Enter key works correctly in Claude Code when run from macOS Terminal.app, which does not use the Kitty keyboard protocol.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.5 (Claude Code)
Platform
Other
Operating System
macOS
Terminal/Shell
Other
Additional Information
Root Cause: Ghostty implements the Kitty keyboard protocol (CSI u encoding). Per the Kitty protocol spec, the regular Enter key is exempt from CSI u encoding for shell compatibility, but KP_Enter (numpad Enter) is not exempt and gets encoded as sequence 57414.
Workaround attempted: Ghostty keybind remapping (keybind = all:kp_enter=text:\x0d) does not intercept the key when an application has requested the Kitty keyboard protocol.
References:
- Kitty keyboard protocol spec: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
- Similar issue in Kitty: https://github.com/kovidgoyal/kitty/issues/7304
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗