mirror of
https://github.com/xvxx/phetch
synced 2024-11-10 13:10:54 +00:00
use Action::List when selecting a link
This commit is contained in:
parent
1743322c16
commit
38f09f7893
14
src/menu.rs
14
src/menu.rs
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user