diff --git a/examples/markup.rs b/examples/markup.rs index b2aabda..289184c 100644 --- a/examples/markup.rs +++ b/examples/markup.rs @@ -2,7 +2,7 @@ extern crate cursive; use cursive::Cursive; #[cfg(feature = "markdown")] -use cursive::utils::markup::MarkdownText; +use cursive::utils::markup::markdown; use cursive::views::{Dialog, TextView}; // Make sure you compile with the `markdown` feature! @@ -13,14 +13,13 @@ fn main() { let mut siv = Cursive::new(); #[cfg(feature = "markdown")] - let text = MarkdownText("Isn't *that* **cool**?"); + let text = markdown::parse("Isn't *that* **cool**?"); #[cfg(not(feature = "markdown"))] let text = "Rebuild with --features markdown ;)"; siv.add_layer( - Dialog::around(TextView::styled(text).unwrap()) - .button("Hell yeah!", |s| s.quit()), + Dialog::around(TextView::new(text)).button("Hell yeah!", |s| s.quit()), ); siv.run(); diff --git a/examples/mutation.rs b/examples/mutation.rs index e4d170d..e7049b4 100644 --- a/examples/mutation.rs +++ b/examples/mutation.rs @@ -14,7 +14,7 @@ fn show_popup(siv: &mut Cursive) { // Look for a view tagged "text". // We _know_ it's there, so unwrap it. s.call_on_id("text", |view: &mut TextView| { - let content = reverse(&view.get_content()); + let content = reverse(view.get_content().source()); view.set_content(content); }); }) diff --git a/src/printer.rs b/src/printer.rs index 0fb2722..65c1647 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -136,10 +136,13 @@ impl<'a> Printer<'a> { /// Call the given closure with a styled printer, /// that will apply the given style on prints. - pub fn with_style(&self, style: Style, f: F) + pub fn with_style(&self, style: T, f: F) where F: FnOnce(&Printer), + T: Into