use Action::List when selecting a link

pull/6/head
dvkt 4 years ago
parent 1743322c16
commit 38f09f7893

@ -1,7 +1,7 @@
use crate::gopher::{self, Type};
use crate::ui::{Action, Key, View, MAX_COLS, SCROLL_LINES};
use std::fmt;
use termion::{clear, cursor};
use termion::cursor;
pub struct Menu {
pub url: String, // gopher url
@ -529,14 +529,22 @@ impl Menu {
let old_link = self.link;
self.link = link;
if self.is_visible(link) {
self.reset_cursor(old_link)
if !self.input.is_empty() {
Action::List(vec![self.redraw_input(), self.reset_cursor(old_link)])
} else {
self.reset_cursor(old_link)
}
} else {
if pos > 5 {
self.scroll = pos - 5;
} else {
self.scroll = 0;
}
Action::Redraw
if !self.input.is_empty() {
Action::List(vec![self.redraw_input(), Action::Redraw])
} else {
Action::Redraw
}
}
} else {
Action::None

@ -401,6 +401,11 @@ impl UI {
};
match action {
Action::List(actions) => {
for action in actions {
self.process_action(action);
}
}
Action::Keypress(Key::Ctrl('c')) => {
if !cleared {
self.running = false

Loading…
Cancel
Save