feat(tui): support Alt-d delete-forward-word (#12455)

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
This commit is contained in:
Douglas Chimento 2026-02-22 19:22:17 +00:00 committed by GitHub
parent 0a0caa9df2
commit 2ada9e1b2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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