input action

pull/6/head
dvkt 5 years ago
parent fbf0cf3064
commit e3ef6f789d

@ -37,23 +37,23 @@ impl View for MenuView {
fn process_input(&mut self, key: Key) -> Action {
match key {
Key::Char('\n') => return Action::Open,
Key::Char('\n') => Action::Open,
Key::Backspace => {
if self.input.is_empty() {
Action::Back
} else {
self.input.pop();
Action::None
Action::Input
}
}
Key::Delete => {
self.input.pop();
Action::None
Action::Input
}
Key::Ctrl('c') => {
if self.input.len() > 0 {
self.input.clear();
Action::None
Action::Input
} else {
Action::Quit
}
@ -63,7 +63,7 @@ impl View for MenuView {
Action::PageUp
} else {
self.input.push('-');
Action::None
Action::Input
}
}
Key::Char(' ') => {
@ -71,7 +71,7 @@ impl View for MenuView {
return Action::PageDown;
} else {
self.input.push(' ');
Action::None
Action::Input
}
}
Key::Char(c) => {
@ -111,9 +111,9 @@ impl View for MenuView {
}
}
}
Action::None
Action::Input
}
_ => Action::None,
_ => Action::Unknown,
}
}
}

@ -27,6 +27,7 @@ pub enum Action {
Open,
Quit,
Unknown,
Input, // redraw the input bar
FollowLink(usize),
}

Loading…
Cancel
Save