From 2ada9e1b2df1c96c888fd007e1fadd218ef67ae6 Mon Sep 17 00:00:00 2001 From: Douglas Chimento Date: Sun, 22 Feb 2026 19:22:17 +0000 Subject: [PATCH] feat(tui): support Alt-d delete-forward-word (#12455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alt-d should delete the next word. It didn’t. Now it does. Added a small test so it stays that way. Details: File updated: [codex-rs/tui/src/bottom_pane/textarea.rs](./codex-rs/tui/src/bottom_pane/textarea.rs) Test added: delete_forward_word_alt_d — verifies Alt-d deletes the next word and keeps the cursor position correct. Solves Issue #12453 --- codex-rs/tui/src/bottom_pane/textarea.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rs index 2caa45602..a32b584c2 100644 --- a/codex-rs/tui/src/bottom_pane/textarea.rs +++ b/codex-rs/tui/src/bottom_pane/textarea.rs @@ -322,7 +322,12 @@ impl TextArea { code: KeyCode::Delete, modifiers: KeyModifiers::ALT, .. - } => self.delete_forward_word(), + } + | KeyEvent { + code: KeyCode::Char('d'), + modifiers: KeyModifiers::ALT, + .. + } => self.delete_forward_word(), KeyEvent { code: KeyCode::Delete, .. @@ -1763,6 +1768,15 @@ mod tests { assert_eq!(t.cursor(), 0); } + #[test] + fn delete_forward_word_alt_d() { + let mut t = ta_with("hello world"); + t.set_cursor(6); + t.input(KeyEvent::new(KeyCode::Char('d'), KeyModifiers::ALT)); + pretty_assertions::assert_eq!(t.text(), "hello "); + pretty_assertions::assert_eq!(t.cursor(), 6); + } + #[test] fn control_h_backspace() { // Test Ctrl+H as backspace