diff --git a/src/backend/curses.rs b/src/backend/curses.rs index 2ec2904..1a6a0c9 100644 --- a/src/backend/curses.rs +++ b/src/backend/curses.rs @@ -1,9 +1,9 @@ use backend; use event::{Event, Key}; -use theme::{BaseColor, Color, ColorStyle, Effect}; -use utf8; use ncurses; +use theme::{BaseColor, Color, ColorStyle, Effect}; +use utf8; pub struct NcursesBackend; diff --git a/src/event.rs b/src/event.rs index fbf6707..7abeaad 100644 --- a/src/event.rs +++ b/src/event.rs @@ -13,10 +13,10 @@ //! [global callback](../struct.Cursive.html#method.add_global_callback) //! table is checked. -use std::rc::Rc; -use std::ops::Deref; use Cursive; +use std::ops::Deref; +use std::rc::Rc; /// Callback is a function that can be triggered by an event. /// It has a mutable access to the cursive root. diff --git a/src/lib.rs b/src/lib.rs index 171815c..a4110c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,22 +104,25 @@ mod utf8; mod backend; -pub use xy::XY; -pub use with::With; -pub use printer::Printer; use backend::{Backend, NcursesBackend}; -use view::Finder; -use std::sync::mpsc; +use event::{Callback, Event, EventResult}; + +pub use printer::Printer; + use std::any::Any; use std::collections::HashMap; use std::path::Path; -use vec::Vec2; -use view::View; +use std::sync::mpsc; + +use vec::Vec2; +use view::Finder; +use view::View; +pub use with::With; +pub use xy::XY; -use event::{Callback, Event, EventResult}; /// Identifies a screen in the cursive ROOT. pub type ScreenId = usize; @@ -467,11 +470,7 @@ impl Cursive { // Draw the currently active screen // If the menubar is active, nothing else can be. - let offset = if self.menubar.autohide { - 0 - } else { - 1 - }; + let offset = if self.menubar.autohide { 0 } else { 1 }; // Draw the menubar? if self.menubar.visible() { let printer = printer.sub_printer(Vec2::zero(), diff --git a/src/menu.rs b/src/menu.rs index 165ba3f..eadcd56 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -12,10 +12,10 @@ //! //! [menubar]: ../struct.Cursive.html#method.menubar -use With; use Cursive; -use std::rc::Rc; +use With; use event::Callback; +use std::rc::Rc; /// Root of a menu tree. #[derive(Default)] diff --git a/src/printer.rs b/src/printer.rs index b453743..2f846f6 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -1,14 +1,14 @@ //! Makes drawing on ncurses windows easier. + +use B; +use backend::Backend; use std::cmp::min; + +use theme::{BorderStyle, ColorStyle, Effect, Theme}; use unicode_segmentation::UnicodeSegmentation; use utils::prefix_length; -use backend::Backend; - -use B; - -use theme::{BorderStyle, ColorStyle, Effect, Theme}; use vec::Vec2; /// Convenient interface to draw on a subset of the screen. diff --git a/src/theme.rs b/src/theme.rs index 8fe6a80..b15624b 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -114,17 +114,17 @@ //! highlight_inactive = "#5555FF" //! ``` -use std::io; -use std::io::Read; -use std::fs::File; -use std::path::Path; - -use backend::Backend; - -use toml; use B; +use backend::Backend; +use std::fs::File; +use std::io; +use std::io::Read; +use std::path::Path; + +use toml; + /// Text effect #[derive(Clone, Copy, Debug)] pub enum Effect { @@ -233,32 +233,32 @@ impl Theme { pub fn activate(&self, backend: &mut B) { // Initialize each color with the backend backend.init_color_style(ColorStyle::Background, - &self.colors.view, - &self.colors.background); + &self.colors.view, + &self.colors.background); backend.init_color_style(ColorStyle::Shadow, - &self.colors.shadow, - &self.colors.shadow); + &self.colors.shadow, + &self.colors.shadow); backend.init_color_style(ColorStyle::Primary, - &self.colors.primary, - &self.colors.view); + &self.colors.primary, + &self.colors.view); backend.init_color_style(ColorStyle::Secondary, - &self.colors.secondary, - &self.colors.view); + &self.colors.secondary, + &self.colors.view); backend.init_color_style(ColorStyle::Tertiary, - &self.colors.tertiary, - &self.colors.view); + &self.colors.tertiary, + &self.colors.view); backend.init_color_style(ColorStyle::TitlePrimary, - &self.colors.title_primary, - &self.colors.view); + &self.colors.title_primary, + &self.colors.view); backend.init_color_style(ColorStyle::TitleSecondary, - &self.colors.title_secondary, - &self.colors.view); + &self.colors.title_secondary, + &self.colors.view); backend.init_color_style(ColorStyle::Highlight, - &self.colors.view, - &self.colors.highlight); + &self.colors.view, + &self.colors.highlight); backend.init_color_style(ColorStyle::HighlightInactive, - &self.colors.view, - &self.colors.highlight_inactive); + &self.colors.view, + &self.colors.highlight_inactive); } } diff --git a/src/utils/lines_iterator.rs b/src/utils/lines_iterator.rs index 00feef6..77b651d 100644 --- a/src/utils/lines_iterator.rs +++ b/src/utils/lines_iterator.rs @@ -1,7 +1,8 @@ -use unicode_width::UnicodeWidthStr; -use unicode_segmentation::UnicodeSegmentation; + use With; +use unicode_segmentation::UnicodeSegmentation; +use unicode_width::UnicodeWidthStr; use utils::prefix_length; /// Generates rows of text in constrained width. diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 214cbad..25249c0 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,7 +1,7 @@ //! Toolbox to make text layout easier. -use unicode_width::UnicodeWidthStr; use unicode_segmentation::UnicodeSegmentation; +use unicode_width::UnicodeWidthStr; mod lines_iterator; mod reader; @@ -55,11 +55,7 @@ pub fn prefix_length<'a, I>(iter: I, width: usize, delimiter: &str) -> usize // We counted delimiter once too many times, // but only if the iterator was non empty. - if sum == 0 { - sum - } else { - sum - delimiter_len - } + if sum == 0 { sum } else { sum - delimiter_len } } /// Computes the length of a suffix that fits in the given `width`. diff --git a/src/vec.rs b/src/vec.rs index 20ff6b3..2016859 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -1,9 +1,10 @@ //! Points on the 2D character grid. + use XY; use direction::Orientation; +use std::cmp::{Ordering, max, min}; use std::ops::{Add, Div, Mul, Sub}; -use std::cmp::{Ordering, max, min}; /// Simple 2D size, in cells. /// diff --git a/src/view/boxable.rs b/src/view/boxable.rs index f3f90df..eb080cc 100644 --- a/src/view/boxable.rs +++ b/src/view/boxable.rs @@ -1,6 +1,6 @@ +use vec::Vec2; use view::{SizeConstraint, View}; use views::BoxView; -use vec::Vec2; /// Makes a view wrappable in a [`BoxView`]. /// diff --git a/src/view/identifiable.rs b/src/view/identifiable.rs index bd35979..162ab15 100644 --- a/src/view/identifiable.rs +++ b/src/view/identifiable.rs @@ -1,5 +1,5 @@ -use views::IdView; use view::View; +use views::IdView; /// Makes a view wrappable in an [`IdView`]. /// diff --git a/src/view/mod.rs b/src/view/mod.rs index 675975d..d1f1284 100644 --- a/src/view/mod.rs +++ b/src/view/mod.rs @@ -50,12 +50,12 @@ mod identifiable; mod boxable; -use std::any::Any; +use Printer; use direction::Direction; use event::{Event, EventResult}; -use vec::Vec2; -use Printer; +pub use self::boxable::Boxable; +pub use self::identifiable::Identifiable; pub use self::position::{Offset, Position}; @@ -65,8 +65,8 @@ pub use self::size_cache::SizeCache; pub use self::size_constraint::SizeConstraint; pub use self::view_path::ViewPath; pub use self::view_wrapper::ViewWrapper; -pub use self::identifiable::Identifiable; -pub use self::boxable::Boxable; +use std::any::Any; +use vec::Vec2; /// Main trait defining a view behaviour. diff --git a/src/view/position.rs b/src/view/position.rs index c5cdac1..524107e 100644 --- a/src/view/position.rs +++ b/src/view/position.rs @@ -1,5 +1,5 @@ -use std::cmp::min; use XY; +use std::cmp::min; use vec::Vec2; /// Location of the view on screen @@ -60,7 +60,8 @@ pub enum Offset { impl Offset { /// Computes a single-dimension offset requred to draw a view. - pub fn compute_offset(&self, size: usize, available: usize, parent: usize) + pub fn compute_offset(&self, size: usize, available: usize, + parent: usize) -> usize { if size > available { 0 @@ -79,17 +80,17 @@ impl Offset { #[cfg(test)] mod tests { - use vec::Vec2; use super::Position; + use vec::Vec2; #[test] fn test_center() { - let center = Position::center(); - assert_eq!(Vec2::new(2, 1), center.compute_offset((1,1), (5,3), (0,0))); - assert_eq!(Vec2::new(2, 0), center.compute_offset((1,3), (5,3), (0,0))); - assert_eq!(Vec2::new(1, 1), center.compute_offset((3,1), (5,3), (0,0))); - assert_eq!(Vec2::new(0, 1), center.compute_offset((5,1), (5,3), (0,0))); - assert_eq!(Vec2::new(0, 0), center.compute_offset((5,3), (5,3), (0,0))); - assert_eq!(Vec2::new(0, 0), center.compute_offset((5,3), (3,1), (0,0))); + let c = Position::center(); + assert_eq!(Vec2::new(2, 1), c.compute_offset((1, 1), (5, 3), (0, 0))); + assert_eq!(Vec2::new(2, 0), c.compute_offset((1, 3), (5, 3), (0, 0))); + assert_eq!(Vec2::new(1, 1), c.compute_offset((3, 1), (5, 3), (0, 0))); + assert_eq!(Vec2::new(0, 1), c.compute_offset((5, 1), (5, 3), (0, 0))); + assert_eq!(Vec2::new(0, 0), c.compute_offset((5, 3), (5, 3), (0, 0))); + assert_eq!(Vec2::new(0, 0), c.compute_offset((5, 3), (3, 1), (0, 0))); } } diff --git a/src/view/scroll.rs b/src/view/scroll.rs index b9abada..cf2f05a 100644 --- a/src/view/scroll.rs +++ b/src/view/scroll.rs @@ -1,8 +1,8 @@ +use Printer; use std::cmp::{max, min}; use theme::ColorStyle; use vec::Vec2; -use Printer; /// Provide scrolling functionalities to a view. /// diff --git a/src/view/view_wrapper.rs b/src/view/view_wrapper.rs index 7dd70f2..b36f4c1 100644 --- a/src/view/view_wrapper.rs +++ b/src/view/view_wrapper.rs @@ -1,10 +1,10 @@ -use std::any::Any; +use Printer; use direction::Direction; +use event::{Event, EventResult}; +use std::any::Any; use vec::Vec2; use view::{Selector, View}; -use Printer; -use event::{Event, EventResult}; /// Generic wrapper around a view. /// diff --git a/src/views/box_view.rs b/src/views/box_view.rs index ec08963..3b5c8d9 100644 --- a/src/views/box_view.rs +++ b/src/views/box_view.rs @@ -38,7 +38,8 @@ impl BoxView { /// Creates a new `BoxView` with the given width and height requirements. /// /// `None` values will use the wrapped view's preferences. - pub fn new(width: SizeConstraint, height: SizeConstraint, view: T) -> Self { + pub fn new(width: SizeConstraint, height: SizeConstraint, view: T) + -> Self { BoxView { size: (width, height).into(), squishable: false, diff --git a/src/views/button.rs b/src/views/button.rs index e300a08..2ee90ae 100644 --- a/src/views/button.rs +++ b/src/views/button.rs @@ -1,10 +1,11 @@ -use unicode_width::UnicodeWidthStr; + use {Cursive, Printer, With}; use align::HAlign; -use event::*; use direction::Direction; +use event::*; use theme::ColorStyle; +use unicode_width::UnicodeWidthStr; use vec::Vec2; use view::View; diff --git a/src/views/checkbox.rs b/src/views/checkbox.rs index 138b39f..fdfa899 100644 --- a/src/views/checkbox.rs +++ b/src/views/checkbox.rs @@ -1,13 +1,13 @@ -use With; use Cursive; use Printer; -use vec::Vec2; -use theme::ColorStyle; -use view::View; -use event::{Event, EventResult, Key}; +use With; use direction::Direction; +use event::{Event, EventResult, Key}; use std::rc::Rc; +use theme::ColorStyle; +use vec::Vec2; +use view::View; /// Checkable box. diff --git a/src/views/dialog.rs b/src/views/dialog.rs index f7fdade..5e6e4b3 100644 --- a/src/views/dialog.rs +++ b/src/views/dialog.rs @@ -1,18 +1,19 @@ -use std::cmp::max; -use std::any::Any; + use Cursive; -use With; -use direction::Direction; -use align::*; -use event::*; -use theme::ColorStyle; -use view::{Selector, View}; -use views::{Button, DummyView, SizedView, TextView}; -use vec::{Vec2, Vec4}; use Printer; +use With; +use align::*; +use direction::Direction; +use event::*; +use std::any::Any; +use std::cmp::max; +use theme::ColorStyle; use unicode_width::UnicodeWidthStr; +use vec::{Vec2, Vec4}; +use view::{Selector, View}; +use views::{Button, DummyView, SizedView, TextView}; #[derive(PartialEq)] enum Focus { diff --git a/src/views/edit_view.rs b/src/views/edit_view.rs index a25d2af..9bd45bb 100644 --- a/src/views/edit_view.rs +++ b/src/views/edit_view.rs @@ -1,15 +1,16 @@ -use unicode_segmentation::UnicodeSegmentation; -use unicode_width::UnicodeWidthStr; -use std::rc::Rc; use {Cursive, Printer, With}; use direction::Direction; +use event::{Callback, Event, EventResult, Key}; + +use std::rc::Rc; use theme::{ColorStyle, Effect}; +use unicode_segmentation::UnicodeSegmentation; +use unicode_width::UnicodeWidthStr; +use utils::simple_suffix_length; use vec::Vec2; use view::View; -use event::{Callback, Event, EventResult, Key}; -use utils::simple_suffix_length; /// Input box where the user can enter and edit text. @@ -289,11 +290,7 @@ impl View for EditView { let display_bytes = content.graphemes(true) .scan(0, |w, g| { *w += g.width(); - if *w > self.last_length { - None - } else { - Some(g) - } + if *w > self.last_length { None } else { Some(g) } }) .map(|g| g.len()) .fold(0, |a, b| a + b); diff --git a/src/views/key_event_view.rs b/src/views/key_event_view.rs index 587a2e9..cbbc1b7 100644 --- a/src/views/key_event_view.rs +++ b/src/views/key_event_view.rs @@ -1,7 +1,8 @@ -use std::collections::HashMap; + use Cursive; use event::{Callback, Event, EventResult}; +use std::collections::HashMap; use view::{View, ViewWrapper}; /// A simple wrapper view that catches some ignored event from its child. diff --git a/src/views/linear_layout.rs b/src/views/linear_layout.rs index 822cc5e..254408f 100644 --- a/src/views/linear_layout.rs +++ b/src/views/linear_layout.rs @@ -1,14 +1,14 @@ -use XY; -use With; -use direction; -use view::View; -use view::{Selector, SizeCache}; -use vec::Vec2; use Printer; +use With; +use XY; +use direction; use event::{Event, EventResult, Key}; use std::any::Any; use std::cmp::min; +use vec::Vec2; +use view::{Selector, SizeCache}; +use view::View; /// Arranges its children linearly according to its orientation. pub struct LinearLayout { @@ -120,11 +120,7 @@ impl LinearLayout { match source { direction::Relative::Front => { - let start = if from_focus { - self.focus - } else { - 0 - }; + let start = if from_focus { self.focus } else { 0 }; Box::new(self.children.iter_mut().enumerate().skip(start)) } @@ -263,11 +259,7 @@ impl View for LinearLayout { let mut overweight: Vec<(usize, usize)> = sizes.iter() .map(|v| self.orientation.get(v)) .zip(min_sizes.iter().map(|v| self.orientation.get(v))) - .map(|(a, b)| if a > b { - a - b - } else { - 0 - }) + .map(|(a, b)| if a > b { a - b } else { 0 }) .enumerate() .collect(); // println_stderr!("Overweight: {:?}", overweight); diff --git a/src/views/list_view.rs b/src/views/list_view.rs index abe98e2..9790976 100644 --- a/src/views/list_view.rs +++ b/src/views/list_view.rs @@ -1,13 +1,13 @@ use Printer; use With; -use vec::Vec2; -use view::View; -use view::Selector; use direction; -use view::ScrollBase; use event::{Event, EventResult, Key}; use std::any::Any; +use vec::Vec2; +use view::ScrollBase; +use view::Selector; +use view::View; enum Child { Row(String, Box), @@ -84,11 +84,7 @@ impl ListView { match source { direction::Relative::Front => { - let start = if from_focus { - self.focus - } else { - 0 - }; + let start = if from_focus { self.focus } else { 0 }; Box::new(self.children.iter_mut().enumerate().skip(start)) } diff --git a/src/views/menu_popup.rs b/src/views/menu_popup.rs index 35b6fae..bb70393 100644 --- a/src/views/menu_popup.rs +++ b/src/views/menu_popup.rs @@ -1,17 +1,18 @@ -use std::rc::Rc; -use std::cmp::min; -use unicode_width::UnicodeWidthStr; use Cursive; -use With; -use menu::{MenuItem, MenuTree}; use Printer; +use With; +use align::Align; +use event::{Callback, Event, EventResult, Key}; +use menu::{MenuItem, MenuTree}; +use std::cmp::min; +use std::rc::Rc; + +use unicode_width::UnicodeWidthStr; +use vec::Vec2; use view::{Position, ScrollBase, View}; use views::KeyEventView; -use align::Align; -use vec::Vec2; -use event::{Callback, Event, EventResult, Key}; /// Popup that shows a list of items. pub struct MenuPopup { @@ -205,11 +206,7 @@ impl View for MenuPopup { let scrolling = req.y < h; - let w = if scrolling { - w + 1 - } else { - w - }; + let w = if scrolling { w + 1 } else { w }; Vec2::new(w, h) } diff --git a/src/views/menubar.rs b/src/views/menubar.rs index 664a839..48198a1 100644 --- a/src/views/menubar.rs +++ b/src/views/menubar.rs @@ -1,17 +1,17 @@ use Cursive; -use view::{Position, View}; -use vec::Vec2; -use direction; -use menu::MenuTree; -use backend::Backend; -use views::{KeyEventView, MenuPopup}; -use theme::ColorStyle; use Printer; +use backend::Backend; +use direction; use event::*; +use menu::MenuTree; use std::rc::Rc; +use theme::ColorStyle; use unicode_width::UnicodeWidthStr; +use vec::Vec2; +use view::{Position, View}; +use views::{KeyEventView, MenuPopup}; /// Current state of the menubar #[derive(PartialEq, Debug)] @@ -169,11 +169,7 @@ impl View for Menubar { .iter() .map(|&(ref title, _)| title.width() + 2) .fold(0, |a, b| a + b), - if self.autohide { - 1 - } else { - 0 - }); + if self.autohide { 1 } else { 0 }); // Since the closure will be called multiple times, // we also need a new Rc on every call. return EventResult::with_cb(move |s| { diff --git a/src/views/mod.rs b/src/views/mod.rs index d43f79f..c388e0f 100644 --- a/src/views/mod.rs +++ b/src/views/mod.rs @@ -58,25 +58,25 @@ mod text_area; mod text_view; mod tracked_view; -pub use self::id_view::IdView; pub use self::box_view::BoxView; pub use self::button::Button; pub use self::checkbox::Checkbox; pub use self::dialog::Dialog; pub use self::dummy::DummyView; pub use self::edit_view::EditView; +pub use self::id_view::IdView; pub use self::key_event_view::KeyEventView; pub use self::linear_layout::LinearLayout; pub use self::list_view::ListView; -pub use self::menubar::Menubar; pub use self::menu_popup::MenuPopup; +pub use self::menubar::Menubar; pub use self::panel::Panel; pub use self::progress_bar::{Counter, ProgressBar}; pub use self::radio::{RadioGroup, RadioButton}; pub use self::select_view::SelectView; -pub use self::slider_view::SliderView; pub use self::shadow_view::ShadowView; pub use self::sized_view::SizedView; +pub use self::slider_view::SliderView; pub use self::stack_view::StackView; pub use self::text_area::TextArea; pub use self::text_view::TextView; diff --git a/src/views/progress_bar.rs b/src/views/progress_bar.rs index 7cf7b2f..8905efa 100644 --- a/src/views/progress_bar.rs +++ b/src/views/progress_bar.rs @@ -1,11 +1,12 @@ -use std::sync::Arc; -use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::cmp; use {Cursive, Printer}; use align::HAlign; +use std::cmp; +use std::sync::Arc; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use std::thread; use theme::{ColorStyle, Effect}; use view::View; diff --git a/src/views/radio.rs b/src/views/radio.rs index e16531a..d1a5741 100644 --- a/src/views/radio.rs +++ b/src/views/radio.rs @@ -1,12 +1,12 @@ use {Printer, With}; -use vec::Vec2; -use view::View; -use theme::ColorStyle; -use event::{Event, EventResult, Key}; use direction::Direction; +use event::{Event, EventResult, Key}; use std::cell::RefCell; use std::rc::Rc; +use theme::ColorStyle; +use vec::Vec2; +use view::View; struct SharedState { selection: usize, @@ -98,7 +98,8 @@ pub struct RadioButton { impl RadioButton { impl_enabled!(self.enabled); - fn new(state: Rc>>, id: usize, label: String) -> Self { + fn new(state: Rc>>, id: usize, label: String) + -> Self { RadioButton { state: state, id: id, diff --git a/src/views/select_view.rs b/src/views/select_view.rs index bc97eb8..3faa6d6 100644 --- a/src/views/select_view.rs +++ b/src/views/select_view.rs @@ -1,21 +1,22 @@ -use std::cmp::min; -use std::rc::Rc; -use std::cell::Cell; -use std::borrow::Borrow; + use Cursive; -use With; -use menu::MenuTree; -use direction::Direction; -use view::{Position, ScrollBase, View}; -use views::MenuPopup; -use align::{Align, HAlign, VAlign}; -use event::{Callback, Event, EventResult, Key}; -use theme::ColorStyle; -use vec::Vec2; use Printer; +use With; +use align::{Align, HAlign, VAlign}; +use direction::Direction; +use event::{Callback, Event, EventResult, Key}; +use menu::MenuTree; +use std::borrow::Borrow; +use std::cell::Cell; +use std::cmp::min; +use std::rc::Rc; +use theme::ColorStyle; use unicode_width::UnicodeWidthStr; +use vec::Vec2; +use view::{Position, ScrollBase, View}; +use views::MenuPopup; /// View to select an item among a list. /// @@ -394,11 +395,7 @@ impl View for SelectView { let scrolling = req.y < h; // Add 2 spaces for the scrollbar if we need - let w = if scrolling { - w + 2 - } else { - w - }; + let w = if scrolling { w + 2 } else { w }; Vec2::new(w, h) } diff --git a/src/views/shadow_view.rs b/src/views/shadow_view.rs index 7af92c0..4c947b7 100644 --- a/src/views/shadow_view.rs +++ b/src/views/shadow_view.rs @@ -1,7 +1,7 @@ -use view::{View, ViewWrapper}; use Printer; -use vec::Vec2; use theme::ColorStyle; +use vec::Vec2; +use view::{View, ViewWrapper}; /// Wrapper view that adds a shadow. /// diff --git a/src/views/sized_view.rs b/src/views/sized_view.rs index dc68a15..a7f8b39 100644 --- a/src/views/sized_view.rs +++ b/src/views/sized_view.rs @@ -1,5 +1,5 @@ -use view::View; use vec::Vec2; +use view::View; use view::ViewWrapper; /// Wrapper around a view that remembers its size. diff --git a/src/views/slider_view.rs b/src/views/slider_view.rs index ebd5a4b..d099933 100644 --- a/src/views/slider_view.rs +++ b/src/views/slider_view.rs @@ -1,12 +1,12 @@ -use std::rc::Rc; +use {Cursive, Printer}; use With; -use {Cursive, Printer}; -use theme::ColorStyle; +use direction::{Direction, Orientation}; use event::{Callback, Event, EventResult, Key}; +use std::rc::Rc; +use theme::ColorStyle; use vec::Vec2; use view::View; -use direction::{Direction, Orientation}; /// A horizontal or vertical slider. pub struct SliderView { diff --git a/src/views/stack_view.rs b/src/views/stack_view.rs index 6181b24..f221ca4 100644 --- a/src/views/stack_view.rs +++ b/src/views/stack_view.rs @@ -1,13 +1,13 @@ -use std::any::Any; +use Printer; +use backend::Backend; use direction::Direction; -use backend::Backend; +use event::{Event, EventResult}; +use std::any::Any; +use theme::ColorStyle; use vec::Vec2; use view::{Offset, Position, Selector, View}; use views::ShadowView; -use event::{Event, EventResult}; -use Printer; -use theme::ColorStyle; /// Simple stack of views. /// Only the top-most view is active and can receive input. diff --git a/src/views/text_area.rs b/src/views/text_area.rs index 742992e..a63be2c 100644 --- a/src/views/text_area.rs +++ b/src/views/text_area.rs @@ -1,14 +1,15 @@ -use unicode_segmentation::UnicodeSegmentation; -use unicode_width::UnicodeWidthStr; -use odds::vec::VecExt; + use {Printer, With, XY}; use direction::Direction; -use vec::Vec2; use event::{Event, EventResult, Key}; -use utils::{LinesIterator, Row, prefix_length}; -use view::{ScrollBase, SizeCache, View}; +use odds::vec::VecExt; use theme::{ColorStyle, Effect}; +use unicode_segmentation::UnicodeSegmentation; +use unicode_width::UnicodeWidthStr; +use utils::{LinesIterator, Row, prefix_length}; +use vec::Vec2; +use view::{ScrollBase, SizeCache, View}; /// Multi-lines text editor. /// diff --git a/src/views/text_view.rs b/src/views/text_view.rs index c23b0a9..40cfa94 100644 --- a/src/views/text_view.rs +++ b/src/views/text_view.rs @@ -1,17 +1,17 @@ -use XY; -use With; -use direction::Direction; -use vec::Vec2; -use view::{SizeCache, View}; use Printer; +use With; +use XY; use align::*; +use direction::Direction; use event::*; -use view::ScrollBase; - -use utils::{LinesIterator, Row}; use unicode_width::UnicodeWidthStr; +use utils::{LinesIterator, Row}; +use vec::Vec2; +use view::{SizeCache, View}; +use view::ScrollBase; + /// A simple view showing a fixed text pub struct TextView { diff --git a/src/views/tracked_view.rs b/src/views/tracked_view.rs index 822fce5..92c77f6 100644 --- a/src/views/tracked_view.rs +++ b/src/views/tracked_view.rs @@ -1,9 +1,9 @@ +use Printer; use std::cell::Cell; +use vec::Vec2; use view::{View, ViewWrapper}; use views::IdView; -use Printer; -use vec::Vec2; /// Wrapper around a view that remembers its position. pub struct TrackedView {