show TLS status in bottom right

pull/14/head
dvkt 5 years ago
parent 9128ffc85b
commit 07c3d4098c

@ -196,6 +196,10 @@ impl UI {
}
}
fn cols(&self) -> u16 {
self.size.0 as u16
}
fn rows(&self) -> u16 {
self.size.1 as u16
}
@ -276,14 +280,31 @@ impl UI {
self.status = status;
}
fn render_tls_status(&self) -> Option<String> {
let page = self.views.get(self.focused)?;
if page.is_tls() {
return Some(format!(
"{}{}{}{}{}",
termion::cursor::Goto(self.cols() - 4, self.rows()),
"\x1b[1m",
color::Fg(color::Black),
color::Bg(color::Green),
"TLS"
));
}
None
}
fn render_status(&self) -> String {
format!(
"{}{}{}{}{}",
"{}{}{}{}{}{}{}",
termion::cursor::Hide,
termion::cursor::Goto(1, self.rows()),
termion::clear::CurrentLine,
self.status,
color::Fg(color::Reset)
self.render_tls_status().unwrap_or_else(|| "".into()),
color::Fg(color::Reset),
color::Bg(color::Reset),
)
}

Loading…
Cancel
Save