diff --git a/examples/logs.rs b/examples/logs.rs index 68e7016..373f84c 100644 --- a/examples/logs.rs +++ b/examples/logs.rs @@ -96,11 +96,11 @@ impl View for BufferView { let (discard,offset) = if self.buffer.len() > printer.size.y as usize { (self.buffer.len() - printer.size.y as usize, 0) } else { - (0, printer.size.y - self.buffer.len() as u32) + (0, printer.size.y - self.buffer.len()) }; for (i, line) in self.ring().skip(discard).enumerate() { - printer.print((0,offset + i as u32), line); + printer.print((0,offset + i), line); } } } diff --git a/src/lib.rs b/src/lib.rs index 1394205..d7e60c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -156,6 +156,7 @@ impl Cursive { self.screen_mut().add_layer(view); } + /// Convenient method to remove a layer from the current screen. pub fn pop_layer(&mut self) { self.screen_mut().pop_layer(); } diff --git a/src/printer.rs b/src/printer.rs index 278c71c..b7744ec 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -61,6 +61,14 @@ impl Printer { /// Returns a wrapper around this printer, /// that will apply the given style on prints. + /// + /// # Examples + /// + /// ``` + /// printer.with_style(color::HIGHLIGHT, |printer| { + /// printer.print((0,0), "This text is highlighted!"); + /// }); + /// ``` pub fn with_style<'a, F>(&'a self, style: color::ThemeColor, f: F) where F: Fn(&Printer) { @@ -75,7 +83,7 @@ impl Printer { /// # Examples /// /// ``` - /// printer.print_box((0,0), (6,4), '+', '-', '|'); + /// printer.print_box((0,0), (6,4)); /// ``` pub fn print_box(&self, start: T, size: T) { let start_v = start.to_vec2(); diff --git a/src/view/dialog.rs b/src/view/dialog.rs index 8b0cbdd..ea8410d 100644 --- a/src/view/dialog.rs +++ b/src/view/dialog.rs @@ -72,6 +72,7 @@ impl Dialog { self } + /// Sets the padding in the dialog (around content and buttons). pub fn padding(mut self, padding: T) -> Self { self.padding = padding.to_vec4(); diff --git a/src/view/full_view.rs b/src/view/full_view.rs index f558c7d..abee21d 100644 --- a/src/view/full_view.rs +++ b/src/view/full_view.rs @@ -3,8 +3,7 @@ use vec::Vec2; /// Simple wrapper view that asks for all the space it can get. pub struct FullView { - /// Wrapped view. - pub view: T, + view: T, } impl FullView { diff --git a/src/view/shadow_view.rs b/src/view/shadow_view.rs index 199117f..9b928d9 100644 --- a/src/view/shadow_view.rs +++ b/src/view/shadow_view.rs @@ -3,11 +3,15 @@ use printer::Printer; use vec::Vec2; use color; +/// Wrapper view that adds a shadow. +/// +/// It reserves a 1 pixel border on each side. pub struct ShadowView { - pub view: T, + view: T, } impl ShadowView { + /// Wraps the given view. pub fn new(view: T) -> Self { ShadowView { view: view,