mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
Apply rustfmt
This commit is contained in:
parent
d29f80869d
commit
2e06dd70cb
@ -1,6 +1,6 @@
|
|||||||
use backend;
|
use backend;
|
||||||
use event::{Event, Key};
|
use event::{Event, Key};
|
||||||
use theme::{Color, ColorStyle, Effect, BaseColor};
|
use theme::{BaseColor, Color, ColorStyle, Effect};
|
||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
use ncurses;
|
use ncurses;
|
||||||
|
@ -347,7 +347,8 @@ impl Cursive {
|
|||||||
/// });
|
/// });
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn find<V: View + Any>(&mut self, sel: &view::Selector) -> Option<&mut V> {
|
pub fn find<V: View + Any>(&mut self, sel: &view::Selector)
|
||||||
|
-> Option<&mut V> {
|
||||||
self.screen_mut().find(sel)
|
self.screen_mut().find(sel)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,9 @@ impl Cursive {
|
|||||||
fn draw(&mut self) {
|
fn draw(&mut self) {
|
||||||
// TODO: don't clone the theme
|
// TODO: don't clone the theme
|
||||||
// Reference it or something
|
// Reference it or something
|
||||||
let printer = Printer::new(self.screen_size(), self.theme.clone(), &mut self.backend);
|
let printer = Printer::new(self.screen_size(),
|
||||||
|
self.theme.clone(),
|
||||||
|
&self.backend);
|
||||||
|
|
||||||
// Draw the currently active screen
|
// Draw the currently active screen
|
||||||
// If the menubar is active, nothing else can be.
|
// If the menubar is active, nothing else can be.
|
||||||
|
@ -8,15 +8,20 @@
|
|||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use {Cursive, Printer, With};
|
pub use {Cursive, Printer, With};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use event::{Event, Key};
|
pub use event::{Event, Key};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use view::{Boxable, Finder, Identifiable, Selector, View};
|
pub use view::{Boxable, Finder, Identifiable, Selector, View};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use views::{BoxView, Button, Checkbox, Dialog, DummyView, EditView,
|
pub use views::{BoxView, Button, Checkbox, Dialog, DummyView, EditView,
|
||||||
IdView, KeyEventView, LinearLayout, ListView, Panel,
|
IdView, KeyEventView, LinearLayout, ListView, Panel,
|
||||||
ProgressBar, SelectView, SliderView, TextArea, TextView};
|
ProgressBar, SelectView, SliderView, TextArea, TextView};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use vec::Vec2;
|
pub use vec::Vec2;
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use menu::MenuTree;
|
pub use menu::MenuTree;
|
||||||
|
@ -130,7 +130,7 @@ impl<'a> Iterator for LinesIterator<'a> {
|
|||||||
// would include the whitespace in the row.
|
// would include the whitespace in the row.
|
||||||
self.offset += 1;
|
self.offset += 1;
|
||||||
other
|
other
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if prefix_length == 0 {
|
if prefix_length == 0 {
|
||||||
@ -154,6 +154,5 @@ impl<'a> Iterator for LinesIterator<'a> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_layout() {
|
fn test_layout() {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ use vec::Vec2;
|
|||||||
///
|
///
|
||||||
/// [`BoxView`]: ../views/struct.BoxView.html
|
/// [`BoxView`]: ../views/struct.BoxView.html
|
||||||
pub trait Boxable: View + Sized {
|
pub trait Boxable: View + Sized {
|
||||||
|
|
||||||
/// Wraps `self` in a `BoxView` with the given size constraints.
|
/// Wraps `self` in a `BoxView` with the given size constraints.
|
||||||
fn boxed(self, width: SizeConstraint, height: SizeConstraint) -> BoxView<Self> {
|
fn boxed(self, width: SizeConstraint, height: SizeConstraint)
|
||||||
|
-> BoxView<Self> {
|
||||||
BoxView::new(width, height, self)
|
BoxView::new(width, height, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ pub trait View {
|
|||||||
///
|
///
|
||||||
/// [`View::find_any`]: ./trait.View.html#method.find_any
|
/// [`View::find_any`]: ./trait.View.html#method.find_any
|
||||||
pub trait Finder {
|
pub trait Finder {
|
||||||
|
|
||||||
/// Tries to find the view pointed to by the given selector.
|
/// Tries to find the view pointed to by the given selector.
|
||||||
///
|
///
|
||||||
/// If the view is not found, or if it is not of the asked type,
|
/// If the view is not found, or if it is not of the asked type,
|
||||||
|
@ -80,7 +80,7 @@ impl Offset {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
use super::{Position};
|
use super::Position;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_center() {
|
fn test_center() {
|
||||||
|
@ -20,7 +20,6 @@ pub enum SizeConstraint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SizeConstraint {
|
impl SizeConstraint {
|
||||||
|
|
||||||
/// Returns the size to be given to the child.
|
/// Returns the size to be given to the child.
|
||||||
///
|
///
|
||||||
/// When `available` is offered to the `BoxView`.
|
/// When `available` is offered to the `BoxView`.
|
||||||
|
@ -181,7 +181,7 @@ impl<T: View> ViewWrapper for BoxView<T> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
use view::{View, Boxable};
|
use view::{Boxable, View};
|
||||||
use views::DummyView;
|
use views::DummyView;
|
||||||
|
|
||||||
// No need to test `draw()` method as it's directly forwarded.
|
// No need to test `draw()` method as it's directly forwarded.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use Cursive;
|
use Cursive;
|
||||||
use view::{View, Position};
|
use view::{Position, View};
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
use direction;
|
use direction;
|
||||||
use menu::MenuTree;
|
use menu::MenuTree;
|
||||||
use backend::Backend;
|
use backend::Backend;
|
||||||
use views::{MenuPopup, KeyEventView};
|
use views::{KeyEventView, MenuPopup};
|
||||||
use theme::ColorStyle;
|
use theme::ColorStyle;
|
||||||
use Printer;
|
use Printer;
|
||||||
use event::*;
|
use event::*;
|
||||||
|
@ -23,7 +23,7 @@ mod text_area;
|
|||||||
mod text_view;
|
mod text_view;
|
||||||
mod tracked_view;
|
mod tracked_view;
|
||||||
|
|
||||||
pub use self::id_view::{IdView};
|
pub use self::id_view::IdView;
|
||||||
pub use self::box_view::BoxView;
|
pub use self::box_view::BoxView;
|
||||||
pub use self::button::Button;
|
pub use self::button::Button;
|
||||||
pub use self::checkbox::Checkbox;
|
pub use self::checkbox::Checkbox;
|
||||||
|
@ -8,7 +8,7 @@ use align::*;
|
|||||||
use event::*;
|
use event::*;
|
||||||
use view::ScrollBase;
|
use view::ScrollBase;
|
||||||
|
|
||||||
use utils::{Row, LinesIterator};
|
use utils::{LinesIterator, Row};
|
||||||
|
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user