Backspace key deletes two characters at a time

Resolved 💬 14 comments Opened Aug 11, 2025 by mlovic Closed Oct 18, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.20.0

Which model were you using?

_No response_

What platform is your computer?

Linux 6.11.0-26-generic x86_64 x86_64

What steps can reproduce the bug?

Backspace key deletes two characters instead of one. Using alacritty terminal on ubuntu. Same issue as #1800 but that one was closed. Several people engaged with that issue after closing, so it seems like this is affecting others too.

The bug happens for me on alacritty and kitty, but not on GNOME terminal.

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

14 Comments

xiyuzhai · 10 months ago

Same here on alacritty.

xiyuzhai · 10 months ago

It's very clear to me that in my case one char was deleted when pressed and another char was deleted when released.

xiyuzhai · 10 months ago

Here's claude analysis after debugging with me:

Here's a summary for the GitHub issue:

---
Root Cause Identified and Fixed

The issue is caused by certain terminal emulators (Alacritty, Kitty) sending duplicate KeyEventKind::Press events for a single backspace keystroke.
Debug logging revealed that when backspace is pressed once, two Press events are received approximately 100-140ms apart.

Investigation Results:

  • Single backspace tap generates two Press events (not Press+Release or Press+Repeat)
  • The duplicate events arrive ~130ms apart on average
  • This only affects backspace, not other keys
  • Only occurs on Alacritty and Kitty, not GNOME Terminal

Solution:

Added debouncing logic to ignore duplicate backspace Press events that arrive within 150ms of each other. The fix is in
tui/src/bottom_pane/chat_composer.rs:

// Debounce duplicate backspace events from certain terminals (Alacritty, Kitty)
if matches!(key_event.code, KeyCode::Backspace) {
// ... check if this is a duplicate within 150ms window
if elapsed_ms < 150 && elapsed_ms > 0 {
return (InputResult::None, false); // Ignore duplicate
}
}

This successfully prevents the double character deletion while still allowing proper backspace repeat when the key is held down (repeat events come
at ~40ms intervals when holding).

The fix has been tested and confirmed working on the affected terminals.

xiyuzhai · 10 months ago

I don't think the problem is with alacritty because gemini and claude works normally.

More likely, it's Crossterm library that causes the problem.

Maybe, this is related: https://github.com/crossterm-rs/crossterm/issues/797#issue-1821472486

newptcai · 10 months ago

I see this in kitty.

tony-snyder-fc · 10 months ago

I upgraded Alacrity to 0.15.1 and no longer have this issue.

newptcai · 10 months ago

I figured this out ---

Root cause: I had two Kitty installations.

  • The system one (installed via apt) was an older build and showed the backspace-deletes-two-chars issue.
  • The user one (installed under ~/.local/kitty.app, version 0.42.2) does not have the issue.

My keyboard shortcut (and x-terminal-emulator) launched the old system Kitty, but when I checked with kitty --version in a shell, it reported the new user build. That mismatch made me think I was already on the latest Kitty.

Fix: Point launchers/shortcuts (and x-terminal-emulator) to the new Kitty binary, or remove the old apt package so there’s only one Kitty on the system.

iGEL · 10 months ago
I upgraded Alacrity to 0.15.1 and no longer have this issue.

I can confirm, updating from 0.14.0 to 0.15.1 fixed the issue for me, too. Thank you!

PlaneInABottle · 10 months ago

Updating kitty, removing apt package and installing kitty.app fixed the issue for me.
Binary Install Kitty

newptcai · 10 months ago

This should be closed since it seems to be a problem due to outdated terminal emulate versions.

al3rez · 10 months ago

updating kitty resolved the issue for me

shaicoleman · 10 months ago

No longer happening with kitty 0.42.2 and codex-cli 0.39.0

tibo-openai collaborator · 9 months ago

Closing as resolved in newer versions of term emulators and codex.

mkxxq · 3 months ago
updating kitty resolved the issue for me

It solved my problem.