Skip to content

fix(tui): support modified backspace/delete keys#21058

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/fix-backspace-combos
May 4, 2026
Merged

fix(tui): support modified backspace/delete keys#21058
fcoury-oai merged 1 commit into
mainfrom
fcoury/fix-backspace-combos

Conversation

@fcoury-oai

Copy link
Copy Markdown
Contributor

Why

Fixes #21046.

Codex TUI 0.128.0 can show Backspace/Delete-related editor shortcuts in /keymap, but Windows-style modified Backspace/Delete events were still dropped by the composer because the default editor keymap did not include those modified special-key variants. On Windows/CMD this meant Shift+Backspace and Shift+Delete did not fall through to normal character deletion, and Ctrl+Backspace / Ctrl+Delete did not perform the word deletion users expect from Windows text inputs.

What Changed

  • Added default editor bindings for shift-backspace and shift-delete so shifted delete keys keep normal grapheme deletion behavior.
  • Added default editor bindings for ctrl-backspace, ctrl-shift-backspace, ctrl-delete, and ctrl-shift-delete so Windows-style word deletion works when terminals preserve those modifiers.
  • Added regression coverage for the resolved default keymap and textarea behavior.

How to Test

  1. Start Codex in the TUI on Windows CMD or another terminal that reports modified Backspace/Delete keys distinctly.
  2. Type hello world in the composer.
  3. Press Ctrl+Backspace; confirm world is removed and hello remains.
  4. Type world again, move the cursor before it, then press Ctrl+Delete; confirm the next word is removed.
  5. Type a few characters and press Shift+Backspace and Shift+Delete; confirm they delete one character in the expected direction instead of doing nothing.
  6. Open /keymap, inspect the Editor deletion actions, and confirm the modified Backspace/Delete aliases are visible as configurable defaults.

Targeted tests:

  • cargo test -p codex-tui keymap::tests
  • cargo test -p codex-tui bottom_pane::textarea::tests
  • cargo test -p codex-tui keymap_setup::tests

@canvrno-oai

Copy link
Copy Markdown
Contributor

If a user already has a /keymap configuration that reuses one of these newly added delete aliases for a different action, these configs result in a hard startup error and prevent the Codex TUI from launching. I think the error is sufficient, /keymap is still pretty new, and it's unlikely to occur for most users; just wanted to note this could come up for a very small subset of users.

Possible config conflcits:

  • shift-backspace
  • shift-delete
  • ctrl-backspace
  • ctrl-shift-backspace
  • ctrl-delete
  • ctrl-shift-delete

Config example:

[tui.keymap.editor]
delete_forward = "shift-backspace"

Resultant error:

codex-rs % ./target/debug/codex
Error: Invalid `tui.keymap` configuration: Ambiguous `tui.keymap.editor` bindings: `delete_backward` and `delete_forward` use the same key. Set unique keys in `~/.codex/config.toml` and retry. See the Codex keymap documentation for supported actions and examples.
Fix the config and retry.
See the Codex keymap documentation for supported actions and examples.

@fcoury-oai fcoury-oai merged commit 87d2235 into main May 4, 2026
26 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/fix-backspace-combos branch May 4, 2026 20:16
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SHIFT + BACKSPACE / CTRL + BACKSPACE not working on Windows

2 participants