majc: support history #3
|
@ -1,7 +1,7 @@
|
||||||
use cursive::{
|
use cursive::{
|
||||||
event::Key,
|
event::Key,
|
||||||
menu::MenuTree,
|
menu::MenuTree,
|
||||||
theme::{Effect, Style, Color, PaletteColor, Theme},
|
theme::{BaseColor, BorderStyle, Color, Effect, PaletteColor, Style, Theme},
|
||||||
traits::*,
|
traits::*,
|
||||||
utils::markup::StyledString,
|
utils::markup::StyledString,
|
||||||
views::{Dialog, EditView, Panel, ResizedView, TextView},
|
views::{Dialog, EditView, Panel, ResizedView, TextView},
|
||||||
|
@ -38,9 +38,8 @@ fn main() {
|
||||||
env!("CARGO_PKG_AUTHORS"),
|
env!("CARGO_PKG_AUTHORS"),
|
||||||
)));
|
)));
|
||||||
})
|
})
|
||||||
.leaf("Help", move |s| {
|
.leaf("Help", help)
|
||||||
help(s);
|
.leaf("Quit", cursive::Cursive::quit),
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
.add_leaf("Open", |s| open_prompt(s));
|
.add_leaf("Open", |s| open_prompt(s));
|
||||||
|
|
||||||
|
@ -170,10 +169,9 @@ fn render_gemini(body: &str) -> StyledString {
|
||||||
Text(line) => styled.append(StyledString::plain(line)),
|
Text(line) => styled.append(StyledString::plain(line)),
|
||||||
Link { to, name } => match name {
|
Link { to, name } => match name {
|
||||||
None => styled.append(StyledString::styled(to, Style::from(Effect::Underline))),
|
None => styled.append(StyledString::styled(to, Style::from(Effect::Underline))),
|
||||||
Some(name) => styled.append(StyledString::styled(
|
Some(name) => {
|
||||||
format!("{}: {}", to, name),
|
styled.append(StyledString::styled(name, Style::from(Effect::Underline)))
|
||||||
Style::from(Effect::Underline),
|
}
|
||||||
)),
|
|
||||||
},
|
},
|
||||||
Preformatted(data) => styled.append(StyledString::plain(data)),
|
Preformatted(data) => styled.append(StyledString::plain(data)),
|
||||||
Heading { level: _, body } => {
|
Heading { level: _, body } => {
|
||||||
|
@ -193,6 +191,12 @@ fn custom_theme_from_cursive(siv: &Cursive) -> Theme {
|
||||||
let mut theme = siv.current_theme().clone();
|
let mut theme = siv.current_theme().clone();
|
||||||
|
|
||||||
theme.palette[PaletteColor::Background] = Color::TerminalDefault;
|
theme.palette[PaletteColor::Background] = Color::TerminalDefault;
|
||||||
|
theme.palette[PaletteColor::View] = Color::TerminalDefault;
|
||||||
|
theme.palette[PaletteColor::Primary] = Color::Dark(BaseColor::White);
|
||||||
|
theme.palette[PaletteColor::TitlePrimary] = Color::Light(BaseColor::White);
|
||||||
|
|
||||||
|
theme.shadow = false;
|
||||||
|
theme.borders = BorderStyle::Simple;
|
||||||
|
|
||||||
theme
|
theme
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue