Backspace deletes twice on Linux in kitty: once on key press and again on key release

Resolved 💬 2 comments Opened Apr 19, 2026 by CodingMantisUA Closed Apr 19, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.121.0

### Which model were you using?

gpt-5.4

### What platform is your computer?

Linux pop-os 6.17.9-76061709-generic x86_64

### What terminal emulator and version are you using (if applicable)?

kitty (TERM=xterm-kitty)

### What issue are you seeing?

In Codex CLI on Linux inside kitty, pressing Backspace deletes two characters instead of one.

The behavior appears to happen on both key press and key release:

  • one character is removed when Backspace is pressed down
  • a second character is removed when Backspace is released

This makes normal text editing unreliable in the TUI.

### What steps can reproduce the bug?

  1. Open kitty on Linux.
  2. Start codex.
  3. Type a short string such as abcd.
  4. Press Backspace once.

### What is the expected behavior?

A single Backspace keypress should delete exactly one character.

### What do you see instead?

One Backspace keypress deletes two characters.

### Additional information

Environment:

  • OS: Pop!_OS / COSMIC
  • TERM=xterm-kitty
  • KITTY_WINDOW_ID is set
  • Codex CLI version: 0.121.0

Notes:

  • This does not look like key repeat from holding the key down.
  • It looks like Codex may be handling both the key press event and the key release event as delete actions.
  • Because this is kitty, it may be related to Kitty Keyboard Protocol handling / key event decoding.

Potentially relevant context:

  • kitty supports press/release-aware keyboard protocol events
  • this may be a TUI input compatibility bug specific to xterm-kitty / kitty keyboard protocol handling

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #17793

Powered by Codex Action

wantianle · 2 months ago

I found a workaround for this.

In kitty, pressing Backspace once reports both press and release events via the kitty keyboard protocol:

kitten show-key -m kitty

Output:

BACKSPACE PRESS
CSI 127 u
BACKSPACE RELEASE
CSI 127 ; 1 : 3 u

Codex appears to treat both events as delete actions. Setting this hidden env var fixes it for me:

CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codex

Persistent workaround:

export CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1

Tested with Codex CLI 0.135.0, kitty 0.32.2, TERM=xterm-kitty, Ubuntu 24.04 Wayland.