Enter key intermittently stops working in Ghostty terminal
Bug Description
The Enter key intermittently stops registering as chat:submit when running Claude Code inside Ghostty. When it fails, pressing Fn+Enter (which sends KP_Enter) works as a workaround. The issue is non-deterministic — Enter works in some sessions/moments and not in others.
Environment
- Claude Code: 2.1.84
- Terminal: Ghostty 1.3.1 (stable)
- OS: macOS 26.3 (Tahoe)
- Shell: zsh
Ghostty Config (relevant)
keybind = shift+enter=text:\x1b\r
No other custom keybinds. No custom keybindings.json for Claude Code exists.
Steps to Reproduce
- Open Ghostty
- Launch
claude - Type a message and press Enter
- Sometimes it submits, sometimes nothing happens
- When Enter fails,
Fn+Enteralways works
Expected Behavior
Enter should always submit the chat message (trigger chat:submit).
Actual Behavior
Enter intermittently fails to register. Fn+Enter works as a workaround.
Investigation
- No
~/.claude/keybindings.jsonexists (all defaults) - Default binding for
chat:submitisenter - Adding
keybind = enter=text:\rto Ghostty config did not resolve the issue - Suspect this may be related to Ghostty's Kitty keyboard protocol support — when the protocol is negotiated, Enter may be encoded as a CSI sequence rather than raw
\r, and Claude Code may not always handle that encoding correctly
Possible Root Cause
Ghostty implements the Kitty keyboard protocol. When Claude Code's terminal UI framework (Ink) negotiates this protocol, the Enter key gets encoded differently (CSI u sequence instead of plain CR \r). If the key input handler doesn't account for both encodings, Enter works only when the protocol isn't active and fails when it is — explaining the intermittent nature.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗