cleanups
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
02558b4dff
commit
ec3020e5b1
|
@ -9,5 +9,6 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cursive = "0.15"
|
cursive = "0.15"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
url = "2"
|
||||||
|
|
||||||
maj = { path = ".." }
|
maj = { path = ".." }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use cursive::{
|
use cursive::{
|
||||||
event::Key,
|
event::Key,
|
||||||
menu::MenuTree,
|
menu::MenuTree,
|
||||||
theme::{Effect, Style},
|
theme::{Effect, Style, Color, PaletteColor, Theme},
|
||||||
traits::*,
|
traits::*,
|
||||||
utils::markup::StyledString,
|
utils::markup::StyledString,
|
||||||
views::{Dialog, EditView, Panel, ResizedView, TextView},
|
views::{Dialog, EditView, Panel, ResizedView, TextView},
|
||||||
|
@ -15,6 +15,9 @@ fn main() {
|
||||||
|
|
||||||
let mut siv = cursive::default();
|
let mut siv = cursive::default();
|
||||||
|
|
||||||
|
let theme = custom_theme_from_cursive(&siv);
|
||||||
|
siv.set_theme(theme);
|
||||||
|
|
||||||
siv.add_global_callback('c', |s| {
|
siv.add_global_callback('c', |s| {
|
||||||
s.pop_layer();
|
s.pop_layer();
|
||||||
});
|
});
|
||||||
|
@ -129,6 +132,26 @@ fn show(siv: &mut Cursive, url: &str, resp: Response) {
|
||||||
open(siv, resp.meta.as_str());
|
open(siv, resp.meta.as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Input => {
|
||||||
|
siv.add_layer(Dialog::info("needs input support"));
|
||||||
|
return;
|
||||||
|
// siv.add_layer(
|
||||||
|
// Dialog::around(EditView::new().with_name("input").fixed_width(50))
|
||||||
|
// .title(resp.meta)
|
||||||
|
// .button("Ok", |s| {
|
||||||
|
// let inp = s
|
||||||
|
// .call_on_name("input", |view: &mut EditView| view.get_content())
|
||||||
|
// .unwrap();
|
||||||
|
// let url = {
|
||||||
|
// let mut u = url::Url::parse(url).unwrap();
|
||||||
|
// u.set_query(Some(&inp));
|
||||||
|
// u.as_str()
|
||||||
|
// };
|
||||||
|
// open(s, url);
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
siv.add_layer(Dialog::info(format!("{:?}: {}", resp.status, resp.meta)));
|
siv.add_layer(Dialog::info(format!("{:?}: {}", resp.status, resp.meta)));
|
||||||
return;
|
return;
|
||||||
|
@ -164,3 +187,12 @@ fn render_gemini(body: &str) -> StyledString {
|
||||||
|
|
||||||
styled
|
styled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn custom_theme_from_cursive(siv: &Cursive) -> Theme {
|
||||||
|
// We'll return the current theme with a small modification.
|
||||||
|
let mut theme = siv.current_theme().clone();
|
||||||
|
|
||||||
|
theme.palette[PaletteColor::Background] = Color::TerminalDefault;
|
||||||
|
|
||||||
|
theme
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue