Skip to content

[BUG] Arrow keys and Escape not working in Kitty/Ghostty terminals (CSI u keyboard protocol issue) #580

@fanorama

Description

@fanorama

When using Factory Droid CLI in Kitty terminal, arrow keys and Escape key don't work
properly. Instead of functioning normally:

• Arrow keys output: 9A, 9B, 9C, 9D
• Escape key outputs: 9u

Environment:
• OS: Arch Linux (linux 6.17.9-arch1-1)
• Terminal: Kitty (also affects Ghostty)
• Factory CLI version: [your version]

Expected behavior:
Arrow keys should navigate and Escape should cancel/exit as expected.

Actual behavior:
Keys output raw CSI u escape sequence characters instead of being interpreted correctly.

Root cause:
Kitty use the modern "CSI u" (fixterms/libtermkey) keyboard protocol for unambiguous key
reporting. Factory CLI's terminal input handling library doesn't properly detect or handle these
sequences.

Workarounds attempted (unsuccessful):
• Setting TERM=xterm-256color
• Adding keyboard_protocol none to kitty.conf

Reference:
This is the same issue that affected Gemini CLI and was fixed in v0.18.2:
google-gemini/gemini-cli#7921

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions