From e09e9e8cef0ac16372e6cd027ad5f460e2d73d11 Mon Sep 17 00:00:00 2001 From: Roland Schaer Date: Tue, 23 Jan 2024 19:50:30 -0300 Subject: [PATCH] fix: input - remove unnecessary code (#26) --- src/input.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/input.rs b/src/input.rs index ac0244d..407e45b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -136,9 +136,6 @@ impl<'a> Input<'a> { fn handle_backspace(&mut self) -> io::Result<()> { let chars_count = self.input.chars().count(); - if chars_count > 1 { - self.term.move_cursor_left(1)?; - } if chars_count > 0 && self.cursor > 0 { self.input.remove(self.cursor - 1); } @@ -150,7 +147,6 @@ impl<'a> Input<'a> { fn handle_arrow_left(&mut self) -> io::Result<()> { if self.cursor > 0 { - self.term.move_cursor_left(1)?; self.cursor -= 1; } Ok(()) @@ -158,7 +154,6 @@ impl<'a> Input<'a> { fn handle_arrow_right(&mut self) -> io::Result<()> { if self.cursor < self.input.chars().count() { - self.term.move_cursor_right(1)?; self.cursor += 1; } Ok(()) @@ -212,8 +207,6 @@ impl<'a> Input<'a> { if !self.placeholder.is_empty() && self.input.is_empty() { out.set_color(&self.theme.input_placeholder)?; write!(out, "{}", &self.placeholder)?; - self.term - .move_cursor_left(self.placeholder.chars().count())?; out.reset()?; }