diff --git a/cursive-core/src/view/view_wrapper.rs b/cursive-core/src/view/view_wrapper.rs index 52c15de..3900a40 100644 --- a/cursive-core/src/view/view_wrapper.rs +++ b/cursive-core/src/view/view_wrapper.rs @@ -101,7 +101,7 @@ pub trait ViewWrapper: 'static { /// Wraps the `important_area` method. fn wrap_important_area(&self, size: Vec2) -> Rect { self.with_view(|v| v.important_area(size)) - .unwrap_or_else(|| Rect::from((0, 0))) + .unwrap_or_else(|| Rect::from_size(Vec2::zero(), size)) } } diff --git a/cursive-core/src/views/linear_layout.rs b/cursive-core/src/views/linear_layout.rs index 268ef7d..977b0a4 100644 --- a/cursive-core/src/views/linear_layout.rs +++ b/cursive-core/src/views/linear_layout.rs @@ -729,10 +729,10 @@ impl View for LinearLayout { Err(ViewNotFound) } - fn important_area(&self, _: Vec2) -> Rect { + fn important_area(&self, size: Vec2) -> Rect { if self.is_empty() { // Return dummy area if we are empty. - return Rect::from((0, 0)); + return Rect::from_size(Vec2::zero(), size); } // Pick the focused item, with its offset diff --git a/cursive-core/src/views/menu_popup.rs b/cursive-core/src/views/menu_popup.rs index 796a439..1520bf2 100644 --- a/cursive-core/src/views/menu_popup.rs +++ b/cursive-core/src/views/menu_popup.rs @@ -303,7 +303,7 @@ impl MenuPopup { fn inner_important_area(&self, size: Vec2) -> Rect { if self.menu.is_empty() { - return Rect::from((0, 0)); + return Rect::from_size(Vec2::zero(), size); } Rect::from_size((0, self.focus), (size.x, 1)) diff --git a/cursive-core/src/views/menubar.rs b/cursive-core/src/views/menubar.rs index 3a4be69..aab851e 100644 --- a/cursive-core/src/views/menubar.rs +++ b/cursive-core/src/views/menubar.rs @@ -414,9 +414,9 @@ impl View for Menubar { Vec2::new(width, 1) } - fn important_area(&self, _: Vec2) -> Rect { + fn important_area(&self, size: Vec2) -> Rect { if self.root.is_empty() { - return Rect::from((0, 0)); + return Rect::from_size(Vec2::zero(), size); } // X position is 1 (margin before the first item) + sum of widths diff --git a/cursive-core/src/views/select_view.rs b/cursive-core/src/views/select_view.rs index d25a2ec..5d5f49e 100644 --- a/cursive-core/src/views/select_view.rs +++ b/cursive-core/src/views/select_view.rs @@ -973,7 +973,7 @@ impl View for SelectView { fn important_area(&self, size: Vec2) -> Rect { self.selected_id() .map(|i| Rect::from_size((0, i), (size.x, 1))) - .unwrap_or_else(|| Rect::from((0, 0))) + .unwrap_or_else(|| Rect::from_size(Vec2::zero(), size)) } } diff --git a/cursive/src/backends/puppet/observed.rs b/cursive/src/backends/puppet/observed.rs index 9dac1bf..9c9b445 100644 --- a/cursive/src/backends/puppet/observed.rs +++ b/cursive/src/backends/puppet/observed.rs @@ -364,9 +364,9 @@ impl<'a> ObservedLine<'a> { line_len: usize, ) -> Self { ObservedLine { - parent, line_start, line_len, + parent, } } @@ -380,9 +380,9 @@ impl<'a> ObservedLine<'a> { ); ObservedLine { - parent: self.parent, line_start: Vec2::new(self.line_start.x - left, self.line_start.y), line_len: self.line_len + left + right, + parent: self.parent, } } } diff --git a/examples/src/bin/logs.rs b/examples/src/bin/logs.rs index 9a287fe..8f93edd 100644 --- a/examples/src/bin/logs.rs +++ b/examples/src/bin/logs.rs @@ -63,7 +63,7 @@ impl BufferView { fn new(size: usize, rx: mpsc::Receiver) -> Self { let mut buffer = VecDeque::new(); buffer.resize(size, String::new()); - BufferView { rx, buffer } + BufferView { buffer, rx } } // Reads available data from the stream into the buffer