Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

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

Douglas Chimento2ada9e1b2df1
diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rs
index 2caa45602f..a32b584c2a 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