pull/6/head
dvkt 5 years ago
parent e7a3ff553e
commit e82f4d7bb9

@ -165,8 +165,7 @@ impl MenuView {
if self.input.is_empty() { if self.input.is_empty() {
Action::Back Action::Back
} else { } else {
self.input.pop(); Action::Unknown
self.redraw_input()
} }
} }
Key::Delete => { Key::Delete => {

@ -7,11 +7,19 @@ pub struct TextView {
impl View for TextView { impl View for TextView {
fn process_input(&mut self, c: Key) -> Action { fn process_input(&mut self, c: Key) -> Action {
Action::None Action::Unknown
} }
fn render(&self, width: u16, height: u16) -> String { fn render(&self, width: u16, height: u16) -> String {
self.raw.to_string() let mut out = String::new();
for (i, line) in self.raw.split_terminator('\n').enumerate() {
if i as u16 > height - 4 {
break;
}
out.push_str(line);
out.push('\n');
}
out
} }
} }

@ -140,7 +140,7 @@ impl UI {
match page.process_input(key) { match page.process_input(key) {
Action::Unknown => match key { Action::Unknown => match key {
Key::Ctrl('q') | Key::Ctrl('c') => return Action::Quit, Key::Ctrl('q') | Key::Ctrl('c') => return Action::Quit,
Key::Left => return Action::Back, Key::Left | Key::Backspace => return Action::Back,
Key::Right => return Action::Forward, Key::Right => return Action::Forward,
_ => {} _ => {}
}, },

Loading…
Cancel
Save