[BUG] macOS: Ghostty terminal keybindings (Ctrl+A/Ctrl+E/Ctrl+U/Ctrl+K) fail in Claude Code (works in iTerm2)

Resolved 💬 5 comments Opened Mar 8, 2026 by aa122121 Closed Apr 5, 2026

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?

Description

Claude Code's TUI fails to recognize standard readline-style keybindings when running in the Ghostty terminal on macOS, while these keybindings work perfectly in iTerm2 (same Claude Code session, same macOS environment). This issue is confirmed to stem from Ghostty's default fixterms encoding mechanism (Ghostty has deprecated fixterms compatibility, per Ghostty maintainers).

| Keybinding | Function | iTerm2 Behavior | Ghostty Behavior |
|------------|-----------------------------------|-----------------|------------------|
| Ctrl+A | Jump to start of line | Works | No effect |
| Ctrl+E | Jump to end of line | Works | No effect |
| Ctrl+U | Delete from cursor to line start | Works | No effect |
| Ctrl+K | Delete from cursor to line end | Works | No effect |

Note: These keybindings work normally in Ghostty for standard shells (bash/zsh) — the issue is isolated to Claude Code's TUI.

Additional Context

  • Ghostty maintainers confirmed: "This is a Claude Code issue — it doesn't understand fixterms (Ghostty's default encoding), and Ghostty has deprecated fixterms compatibility. Claude should create a TUI that works without hacks." (https://github.com/ghostty-org/ghostty/discussions/11206 )
  • We have tried mapping Ghostty's keybinds to match iTerm2's raw ASCII output (Ctrl+A → \x01, Ctrl+E → \x05, etc.) — the issue persists.
  • The keybindings output correct raw characters in Ghostty (verified via cat -v: ^A/^E/^U/^K), but Claude Code's TUI does not interpret them correctly.

What Should Happen?

Expected Behavior

Claude Code's TUI should recognize standard readline keybindings in Ghostty (macOS) identically to iTerm2, either by supporting Ghostty's fixterms encoding or Kitty keyboard protocol (Ghostty also supports Kitty protocol), or by aligning with raw ASCII control character interpretation.

Request

Please adapt Claude Code's TUI to support Ghostty's terminal encoding (fixterms/Kitty protocol) on macOS, so that standard line-editing keybindings work consistently across mainstream terminals (iTerm2/Ghostty).

Error Messages/Logs

Steps to Reproduce

Environment

  • OS: 13.7.8 (22H730)
  • Ghostty Version: 1.2.3
  • iTerm2 Version: 3.6.8
  • Claude Code Version: 2.1.71
  • TERM Value:
  • Ghostty: xterm-256color (forced, default is xterm-ghostty)
  • iTerm2: xterm-256color

Steps to Reproduce

  1. On macOS, open iTerm2 and launch Claude Code.
  2. Test Ctrl+A/Ctrl+E/Ctrl+U/Ctrl+K — all keybindings work as expected (line editing functions).
  3. Open Ghostty (configure term = xterm-256color to match iTerm2, map keybinds to raw ASCII codes via unconsumed: prefix per Ghostty docs).
  4. Launch the same Claude Code session in Ghostty.
  5. Test the four keybindings — none produce the intended behavior (no error messages, just no effect).

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.71

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗