quit, at least

pull/6/head
dvkt 5 years ago
parent add433141a
commit 2750aec73a

@ -46,18 +46,6 @@ impl View for PageView {
self.input.pop();
Action::None
}
Key::Backspace => {
if self.input.is_empty() {
Action::Back
} else {
self.input.pop();
Action::None
}
}
Key::Delete => {
self.input.pop();
Action::None
}
Key::Ctrl('c') => {
if self.input.len() > 0 {
self.input.clear();

@ -88,14 +88,17 @@ impl UI {
}
fn respond_to_user(&mut self) {
self.process_input();
match self.process_input() {
Action::Quit => std::process::exit(1),
_ => {}
}
}
fn process_input(&mut self) -> Action {
let stdin = stdin();
let mut stdout = stdout().into_raw_mode().unwrap();
stdout.flush().unwrap();
let mut page = self.mut_view().expect("expected page to be loaded");
let page = self.mut_view().expect("expected page to be loaded");
for c in stdin.keys() {
let key = c.expect("UI error on stdin.keys");

Loading…
Cancel
Save