Adaptive backspace acceleration for the TUI

Open 💬 1 comment Opened Aug 9, 2026 by ifrederico

What variant of Codex are you using?

CLI (TUI)

What feature would you like to see?

Sometimes I write a long prompt and want to remove a sentence or a larger section. Holding Backspace deletes one character at a time, so it takes longer than it should.

Could plain Backspace speed up when it is held, similar to text editing on the iPhone?

A simple version could work like this:

  • A normal Backspace press deletes one character.
  • Holding Backspace starts with character deletion.
  • After a short delay, it switches to deleting one word at a time.
  • Releasing Backspace or pressing another key resets it.

Normal taps would stay precise. The faster behavior would only start after the key has been held for a while.

Codex already supports word deletion shortcuts such as Option or Alt + Backspace, Ctrl + Backspace, and Ctrl + W. This proposal would not replace those shortcuts. It would add automatic acceleration when plain Backspace is held.

This should not depend on Ghostty or any specific terminal. Some terminals send repeat events for a held key, while others send a stream of press events. Handling both would keep the behavior consistent across terminals and operating systems.

I tested a small prototype locally and it feels much better for editing long prompts. The timing is only a starting point and can be changed.

Would this fit the direction of the TUI? If so, I would be happy to follow the approach the team prefers.

Additional information

I searched the existing issues and found reports about Backspace bugs and word deletion shortcuts, but I did not find this hold-to-accelerate behavior.

I will add a short side-by-side video here before submitting.

Prototype branch:
https://github.com/ifrederico/codex/tree/agent/adaptive-backspace-acceleration

The prototype has focused behavior tests, snapshot coverage, and a test that checks the yank buffer is preserved. I also ran:

  • just fmt
  • just fix -p codex-tui
  • just test -p codex-tui

This is only a prototype for discussion. I have not opened a pull request.

https://github.com/user-attachments/assets/107230ce-c663-4df8-a061-503541e4c9f9

View original on GitHub ↗

1 Comment

jdcodes1 · 9 days ago

Two notes: (1) today the fast paths already exist as chords — word-delete and kill-line are bound in the composer keymap (tui/src/keymap.rs: delete_backward_word on Ctrl/Alt+Backspace variants, kill-line variants alongside), and they're rebindable via [tui.keymap] — so "delete a sentence" has a non-repeat answer now. (2) For actual hold-to-accelerate: key repeat events all look identical to the TUI (terminals just re-send the key), so acceleration would be inferred timing — track inter-Backspace intervals in the composer and escalate to delete_backward_word (or N chars/tick) once repeats arrive faster than ~40 ms for some run length, resetting on any other key. That's implementable entirely inside Textarea::input (tui/src/bottom_pane/textarea.rs, delete_backward already takes an n), no terminal cooperation needed — the design question is discoverability/surprise, which an opt-in [tui] backspace_acceleration = true sidesteps.