From 93ceb17c21b636a36432c82f5972037cfdfb7d81 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Tue, 2 Aug 2016 00:36:27 -0700 Subject: [PATCH] Rename `scrollbar_padding` -> `scrollbar_offset` in ScrollBase --- src/view/scroll.rs | 14 +++++++------- src/views/menu_popup.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/view/scroll.rs b/src/view/scroll.rs index 13ce7cf..589486c 100644 --- a/src/view/scroll.rs +++ b/src/view/scroll.rs @@ -19,11 +19,11 @@ pub struct ScrollBase { /// Padding for the scrollbar /// /// If present, the scrollbar will be shifted - /// `scrollbar_padding` columns to the left. + /// `scrollbar_offset` columns to the left. /// /// (Useful when each item includes its own side borders, /// to draw the scrollbar inside.) - pub scrollbar_padding: usize, + pub scrollbar_offset: usize, } impl ScrollBase { @@ -33,7 +33,7 @@ impl ScrollBase { start_line: 0, content_height: 0, view_height: 0, - scrollbar_padding: 0, + scrollbar_offset: 0, } } @@ -42,8 +42,8 @@ impl ScrollBase { /// Used by views that draw their side borders in the children. /// Pushing the scrollbar to the left allows it to stay inside /// the borders. - pub fn bar_padding(mut self, padding: usize) -> Self { - self.scrollbar_padding = padding; + pub fn bar_offset(mut self, padding: usize) -> Self { + self.scrollbar_offset = padding; self } @@ -143,7 +143,7 @@ impl ScrollBase { if printer.size.x < 2 { return; } - printer.size.x - 2 + self.scrollbar_padding // TODO: 2 + printer.size.x - 2 + self.scrollbar_offset } else { printer.size.x }; @@ -180,7 +180,7 @@ impl ScrollBase { }; // TODO: use 1 instead of 2 - let scrollbar_x = printer.size.x - 1 - self.scrollbar_padding; + let scrollbar_x = printer.size.x - 1 - self.scrollbar_offset; printer.print_vline((scrollbar_x, 0), printer.size.y, "|"); printer.with_color(color, |printer| { printer.print_vline((scrollbar_x, start), height, " "); diff --git a/src/views/menu_popup.rs b/src/views/menu_popup.rs index edb9fc5..14b7525 100644 --- a/src/views/menu_popup.rs +++ b/src/views/menu_popup.rs @@ -29,7 +29,7 @@ impl MenuPopup { MenuPopup { menu: menu, focus: 0, - scrollbase: ScrollBase::new().bar_padding(1), + scrollbase: ScrollBase::new().bar_offset(1), align: Align::top_left(), on_dismiss: None, on_action: None,