mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Rustfmt
This commit is contained in:
parent
d41f1e937d
commit
f8588e74c1
@ -68,6 +68,7 @@ fn main() {
|
|||||||
|
|
||||||
// When `autohide` is on (default), the menu only appears when active.
|
// When `autohide` is on (default), the menu only appears when active.
|
||||||
// Turning it off will leave the menu always visible.
|
// Turning it off will leave the menu always visible.
|
||||||
|
// Try uncommenting this line!
|
||||||
|
|
||||||
// siv.set_autohide_menu(false);
|
// siv.set_autohide_menu(false);
|
||||||
|
|
||||||
|
@ -178,10 +178,10 @@ impl backend::Backend for Concrete {
|
|||||||
fn with_effect<F: FnOnce()>(&self, effect: Effect, f: F) {
|
fn with_effect<F: FnOnce()>(&self, effect: Effect, f: F) {
|
||||||
match effect {
|
match effect {
|
||||||
// TODO: does BLT support bold/italic/underline?
|
// TODO: does BLT support bold/italic/underline?
|
||||||
Effect::Bold |
|
Effect::Bold
|
||||||
Effect::Italic |
|
| Effect::Italic
|
||||||
Effect::Underline |
|
| Effect::Underline
|
||||||
Effect::Simple => f(),
|
| Effect::Simple => f(),
|
||||||
// TODO: how to do this correctly?`
|
// TODO: how to do this correctly?`
|
||||||
// BLT itself doesn't do this kind of thing,
|
// BLT itself doesn't do this kind of thing,
|
||||||
// we'd need the colours in our position,
|
// we'd need the colours in our position,
|
||||||
|
@ -24,4 +24,3 @@ impl<S: Deref<Target = String>> From<S> for BorderStyle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +121,13 @@ mod color_style;
|
|||||||
mod border_style;
|
mod border_style;
|
||||||
mod palette;
|
mod palette;
|
||||||
|
|
||||||
pub use self::color::{Color, BaseColor};
|
|
||||||
pub use self::border_style::BorderStyle;
|
pub use self::border_style::BorderStyle;
|
||||||
|
pub use self::color::{BaseColor, Color};
|
||||||
pub use self::color_pair::ColorPair;
|
pub use self::color_pair::ColorPair;
|
||||||
pub use self::color_style::ColorStyle;
|
pub use self::color_style::ColorStyle;
|
||||||
pub use self::effect::Effect;
|
pub use self::effect::Effect;
|
||||||
pub use self::palette::Palette;
|
pub use self::palette::Palette;
|
||||||
pub use self::style::Style;
|
pub use self::style::Style;
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
@ -183,8 +182,6 @@ impl Theme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Possible error returned when loading a theme.
|
/// Possible error returned when loading a theme.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
@ -206,7 +203,6 @@ impl From<toml::de::Error> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Loads a theme from file and sets it as active.
|
/// Loads a theme from file and sets it as active.
|
||||||
pub fn load_theme_file<P: AsRef<Path>>(filename: P) -> Result<Theme, Error> {
|
pub fn load_theme_file<P: AsRef<Path>>(filename: P) -> Result<Theme, Error> {
|
||||||
let content = {
|
let content = {
|
||||||
@ -233,4 +229,3 @@ pub fn load_theme(content: &str) -> Result<Theme, Error> {
|
|||||||
pub fn load_default() -> Theme {
|
pub fn load_default() -> Theme {
|
||||||
Theme::default()
|
Theme::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
use super::{prefix, Row};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use super::{prefix, Row};
|
|
||||||
|
|
||||||
/// Generates rows of text in constrained width.
|
/// Generates rows of text in constrained width.
|
||||||
///
|
///
|
||||||
|
@ -9,7 +9,6 @@ mod row;
|
|||||||
|
|
||||||
pub use self::lines_iterator::LinesIterator;
|
pub use self::lines_iterator::LinesIterator;
|
||||||
pub use self::row::Row;
|
pub use self::row::Row;
|
||||||
|
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
|
@ -34,4 +34,3 @@ impl Row {
|
|||||||
self.end -= offset;
|
self.end -= offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +15,11 @@ mod segment;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use theme::Style;
|
|
||||||
|
|
||||||
pub use self::lines_iterator::SpanLinesIterator;
|
pub use self::lines_iterator::SpanLinesIterator;
|
||||||
pub use self::row::Row;
|
pub use self::row::Row;
|
||||||
pub use self::segment::Segment;
|
pub use self::segment::Segment;
|
||||||
|
use std::borrow::Cow;
|
||||||
|
use theme::Style;
|
||||||
|
|
||||||
/// Input to the algorithm
|
/// Input to the algorithm
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
@ -37,4 +36,3 @@ pub struct Span<'a> {
|
|||||||
/// Style to apply to this span of text.
|
/// Style to apply to this span of text.
|
||||||
pub style: Style,
|
pub style: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,4 +109,3 @@ fn consider_chunk(available: usize, chunk: &Chunk) -> ChunkFitResult {
|
|||||||
ChunkFitResult::DoesNotFit
|
ChunkFitResult::DoesNotFit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
use super::{Segment, Span};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use super::{Span, Segment};
|
|
||||||
|
|
||||||
/// A list of segments representing a row of text
|
/// A list of segments representing a row of text
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Row {
|
pub struct Row {
|
||||||
@ -29,5 +28,3 @@ impl Row {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/// Refers to a part of a span
|
/// Refers to a part of a span
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct Segment {
|
pub struct Segment {
|
||||||
|
@ -46,5 +46,3 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,7 +540,8 @@ impl View for TextView {
|
|||||||
self.rows.len()
|
self.rows.len()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.scrollbase.set_heights(available_height, self.rows.len());
|
self.scrollbase
|
||||||
|
.set_heights(available_height, self.rows.len());
|
||||||
self.adjust_scroll();
|
self.adjust_scroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user