This commit is contained in:
Alexandre Bury 2018-01-09 15:17:49 +01:00
parent d41f1e937d
commit f8588e74c1
13 changed files with 12 additions and 27 deletions

View File

@ -68,6 +68,7 @@ fn main() {
// When `autohide` is on (default), the menu only appears when active.
// Turning it off will leave the menu always visible.
// Try uncommenting this line!
// siv.set_autohide_menu(false);

View File

@ -178,10 +178,10 @@ impl backend::Backend for Concrete {
fn with_effect<F: FnOnce()>(&self, effect: Effect, f: F) {
match effect {
// TODO: does BLT support bold/italic/underline?
Effect::Bold |
Effect::Italic |
Effect::Underline |
Effect::Simple => f(),
Effect::Bold
| Effect::Italic
| Effect::Underline
| Effect::Simple => f(),
// TODO: how to do this correctly?`
// BLT itself doesn't do this kind of thing,
// we'd need the colours in our position,

View File

@ -24,4 +24,3 @@ impl<S: Deref<Target = String>> From<S> for BorderStyle {
}
}
}

View File

@ -121,14 +121,13 @@ mod color_style;
mod border_style;
mod palette;
pub use self::color::{Color, BaseColor};
pub use self::border_style::BorderStyle;
pub use self::color::{BaseColor, Color};
pub use self::color_pair::ColorPair;
pub use self::color_style::ColorStyle;
pub use self::effect::Effect;
pub use self::palette::Palette;
pub use self::style::Style;
use std::fs::File;
use std::io;
use std::io::Read;
@ -183,8 +182,6 @@ impl Theme {
}
}
/// Possible error returned when loading a theme.
#[derive(Debug)]
pub enum Error {
@ -206,7 +203,6 @@ impl From<toml::de::Error> for Error {
}
}
/// Loads a theme from file and sets it as active.
pub fn load_theme_file<P: AsRef<Path>>(filename: P) -> Result<Theme, Error> {
let content = {
@ -233,4 +229,3 @@ pub fn load_theme(content: &str) -> Result<Theme, Error> {
pub fn load_default() -> Theme {
Theme::default()
}

View File

@ -1,6 +1,6 @@
use super::{prefix, Row};
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use super::{prefix, Row};
/// Generates rows of text in constrained width.
///

View File

@ -9,7 +9,6 @@ mod row;
pub use self::lines_iterator::LinesIterator;
pub use self::row::Row;
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;

View File

@ -34,4 +34,3 @@ impl Row {
self.end -= offset;
}
}

View File

@ -15,12 +15,11 @@ mod segment;
#[cfg(test)]
mod tests;
use std::borrow::Cow;
use theme::Style;
pub use self::lines_iterator::SpanLinesIterator;
pub use self::row::Row;
pub use self::segment::Segment;
use std::borrow::Cow;
use theme::Style;
/// Input to the algorithm
#[derive(Debug, Clone, PartialEq, Eq)]
@ -37,4 +36,3 @@ pub struct Span<'a> {
/// Style to apply to this span of text.
pub style: Style,
}

View File

@ -109,4 +109,3 @@ fn consider_chunk(available: usize, chunk: &Chunk) -> ChunkFitResult {
ChunkFitResult::DoesNotFit
}
}

View File

@ -1,7 +1,6 @@
use super::{Segment, Span};
use std::borrow::Cow;
use super::{Span, Segment};
/// A list of segments representing a row of text
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Row {
@ -29,5 +28,3 @@ impl Row {
.collect()
}
}

View File

@ -1,4 +1,3 @@
/// Refers to a part of a span
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Segment {

View File

@ -46,5 +46,3 @@ where
}
}
}

View File

@ -540,7 +540,8 @@ impl View for TextView {
self.rows.len()
};
self.scrollbase.set_heights(available_height, self.rows.len());
self.scrollbase
.set_heights(available_height, self.rows.len());
self.adjust_scroll();
}
}