diff --git a/src/view/component/input.rs b/src/view/component/input.rs index 6b7f813..70f1bd9 100644 --- a/src/view/component/input.rs +++ b/src/view/component/input.rs @@ -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; + } } _ => {} }