Input backspace
This commit is contained in:
@@ -48,9 +48,20 @@ impl Component for InputComponent {
|
||||
self.cursor += 1;
|
||||
}
|
||||
(Backspace, &KeyModifiers::NONE) => {
|
||||
if self.value.pop().is_some() {
|
||||
if self.cursor > 0 {
|
||||
self.value.remove(self.cursor - 1);
|
||||
self.cursor -= 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
(Left, &KeyModifiers::NONE) => {
|
||||
if self.cursor > 0 {
|
||||
self.cursor -= 1;
|
||||
}
|
||||
}
|
||||
(Right, &KeyModifiers::NONE) => {
|
||||
if self.cursor < self.value.len() {
|
||||
self.cursor += 1;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user