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

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

@ -7,11 +7,19 @@ pub struct TextView {
impl View for TextView {
fn process_input(&mut self, c: Key) -> Action {
Action::None
Action::Unknown
}
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) {
Action::Unknown => match key {
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,
_ => {}
},

Loading…
Cancel
Save