fixed up writing to/deleting (but overflows still happen it seems)

This commit is contained in:
emilis 2023-01-15 23:18:58 +00:00
parent b749733fb7
commit 7434a2b94d
1 changed files with 18 additions and 2 deletions

View File

@ -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 => {}