diff --git a/src/display/body.rs b/src/display/body.rs index f1cffe8..35c163a 100644 --- a/src/display/body.rs +++ b/src/display/body.rs @@ -195,6 +195,16 @@ impl SigninPage { ] .into() } + + #[inline] + fn char(&mut self, c: char) { + match self.cursor { + SigninCursorLocation::Hostname => { + self.hostname.push(c); + } + SigninCursorLocation::Ok => {} + } + } } impl Page for SigninPage { @@ -206,10 +216,16 @@ impl Page for SigninPage { ) -> Result<()> { match event { Event::Key(key) => match key { - termion::event::Key::Char(_) => {} + termion::event::Key::Char(c) => self.char(c), termion::event::Key::Up => self.next(), termion::event::Key::Down => self.previous(), - termion::event::Key::Backspace => {} + termion::event::Key::Backspace => { + if let SigninCursorLocation::Hostname = + self.cursor + { + self.hostname.pop(); + } + } termion::event::Key::Delete => {} termion::event::Key::Left => {} termion::event::Key::Right => {}