mirror of
https://github.com/openai/codex.git
synced 2026-11-01 16:17:58 +00:00
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:
@@ -322,7 +322,12 @@ impl TextArea {
|
|||||||
code: KeyCode::Delete,
|
code: KeyCode::Delete,
|
||||||
modifiers: KeyModifiers::ALT,
|
modifiers: KeyModifiers::ALT,
|
||||||
..
|
..
|
||||||
} => self.delete_forward_word(),
|
}
|
||||||
|
| KeyEvent {
|
||||||
|
code: KeyCode::Char('d'),
|
||||||
|
modifiers: KeyModifiers::ALT,
|
||||||
|
..
|
||||||
|
} => self.delete_forward_word(),
|
||||||
KeyEvent {
|
KeyEvent {
|
||||||
code: KeyCode::Delete,
|
code: KeyCode::Delete,
|
||||||
..
|
..
|
||||||
@@ -1763,6 +1768,15 @@ mod tests {
|
|||||||
assert_eq!(t.cursor(), 0);
|
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]
|
#[test]
|
||||||
fn control_h_backspace() {
|
fn control_h_backspace() {
|
||||||
// Test Ctrl+H as backspace
|
// Test Ctrl+H as backspace
|
||||||
|
|||||||
Reference in New Issue
Block a user