|
|
@ -1,6 +1,7 @@
|
|
|
|
use crate::gopher::{self, Type};
|
|
|
|
use crate::gopher::{self, Type};
|
|
|
|
use crate::ui::{Action, Key, View, MAX_COLS, SCROLL_LINES};
|
|
|
|
use crate::ui::{Action, Key, View, MAX_COLS, SCROLL_LINES};
|
|
|
|
use std::fmt;
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
use termion::{clear, cursor};
|
|
|
|
|
|
|
|
|
|
|
|
pub struct Menu {
|
|
|
|
pub struct Menu {
|
|
|
|
pub url: String, // gopher url
|
|
|
|
pub url: String, // gopher url
|
|
|
@ -232,7 +233,7 @@ impl Menu {
|
|
|
|
let &pos = self.links.get(link)?;
|
|
|
|
let &pos = self.links.get(link)?;
|
|
|
|
Some(format!(
|
|
|
|
Some(format!(
|
|
|
|
"{} ",
|
|
|
|
"{} ",
|
|
|
|
termion::cursor::Goto((self.indent() + 1) as u16, (pos + 1) as u16)
|
|
|
|
cursor::Goto((self.indent() + 1) as u16, (pos + 1) as u16)
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -245,7 +246,7 @@ impl Menu {
|
|
|
|
let &pos = self.links.get(self.link)?;
|
|
|
|
let &pos = self.links.get(self.link)?;
|
|
|
|
Some(format!(
|
|
|
|
Some(format!(
|
|
|
|
"{}\x1b[97;1m*\x1b[0m",
|
|
|
|
"{}\x1b[97;1m*\x1b[0m",
|
|
|
|
termion::cursor::Goto((self.indent() + 1) as u16, (pos + 1) as u16)
|
|
|
|
cursor::Goto((self.indent() + 1) as u16, (pos + 1) as u16)
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -253,10 +254,10 @@ impl Menu {
|
|
|
|
fn render_input(&self) -> String {
|
|
|
|
fn render_input(&self) -> String {
|
|
|
|
format!(
|
|
|
|
format!(
|
|
|
|
"{}Find:\x1b[0m {}{}{}",
|
|
|
|
"{}Find:\x1b[0m {}{}{}",
|
|
|
|
termion::cursor::Goto(1, self.rows() as u16),
|
|
|
|
cursor::Goto(1, self.rows() as u16),
|
|
|
|
self.input,
|
|
|
|
self.input,
|
|
|
|
termion::cursor::Show,
|
|
|
|
cursor::Show,
|
|
|
|
termion::clear::UntilNewline,
|
|
|
|
clear::UntilNewline,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -266,9 +267,9 @@ impl Menu {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Action::Draw(format!(
|
|
|
|
Action::Draw(format!(
|
|
|
|
"{}{}{}",
|
|
|
|
"{}{}{}",
|
|
|
|
termion::cursor::Goto(1, self.rows() as u16),
|
|
|
|
cursor::Goto(1, self.rows() as u16),
|
|
|
|
termion::clear::CurrentLine,
|
|
|
|
clear::CurrentLine,
|
|
|
|
termion::cursor::Hide
|
|
|
|
cursor::Hide
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|