Delete key and backspace for ascii

This commit is contained in:
2026-07-15 09:03:27 -04:00
parent 1eba11c8b1
commit 0f6dbc29fe
+35
View File
@@ -67,6 +67,41 @@ impl InputState {
true
}
Event::Key(KeyEvent {
code: KeyCode::Char('h'),
modifiers,
..
}) if modifiers.contains(KeyModifiers::CONTROL) => {
if self.cursor > 0 {
let prev = self.text[..self.cursor]
.char_indices()
.last()
.map(|(i, _)| i)
.unwrap();
self.text.remove(prev);
self.cursor = prev;
}
true
}
Event::Key(KeyEvent {
code: KeyCode::Delete,
..
}) => {
if self.cursor < self.text.len() {
let prev = self.text[..self.cursor+1]
.char_indices()
.last()
.map(|(i, _)| i)
.unwrap();
self.text.remove(prev);
self.cursor = prev;
}
true
}
Event::Key(KeyEvent {
code: KeyCode::Char(c),
modifiers,