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:
parent
0a0caa9df2
commit
2ada9e1b2d
1 changed files with 15 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue