mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
Add missing imports
This commit is contained in:
parent
2735bf45fd
commit
b59e480f60
@ -37,7 +37,7 @@ pub struct Span {
|
|||||||
/// extern crate unicode_segmentation;
|
/// extern crate unicode_segmentation;
|
||||||
/// use unicode_segmentation::UnicodeSegmentation;
|
/// use unicode_segmentation::UnicodeSegmentation;
|
||||||
///
|
///
|
||||||
/// # use cursive::utils::prefix;
|
/// # use cursive::utils::lines::simple::prefix;
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// let my_text = "blah...";
|
/// let my_text = "blah...";
|
||||||
/// // This returns the number of bytes for a prefix of `my_text` that
|
/// // This returns the number of bytes for a prefix of `my_text` that
|
||||||
@ -109,3 +109,15 @@ pub fn simple_suffix(text: &str, width: usize) -> Span {
|
|||||||
pub fn simple_prefix(text: &str, width: usize) -> Span {
|
pub fn simple_prefix(text: &str, width: usize) -> Span {
|
||||||
prefix(text.graphemes(true), width, "")
|
prefix(text.graphemes(true), width, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::prefix;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_prefix() {
|
||||||
|
assert_eq!(prefix(" abra ".split(' '), 5, " ").length, 5);
|
||||||
|
assert_eq!(prefix("abra a".split(' '), 5, " ").length, 4);
|
||||||
|
assert_eq!(prefix("a a br".split(' '), 5, " ").length, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -16,7 +16,7 @@ pub struct Segment {
|
|||||||
|
|
||||||
impl Segment {
|
impl Segment {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn with_text<'a>(self, text: &'a str) -> SegmentWithText<'a> {
|
pub fn with_text<'a>(self, text: &'a str) -> SegmentWithText<'a> {
|
||||||
SegmentWithText { text, seg: self }
|
SegmentWithText { text, seg: self }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
use super::*;
|
use theme::Style;
|
||||||
|
use super::Span;
|
||||||
|
use super::chunk::Chunk;
|
||||||
|
use super::row::Row;
|
||||||
|
use super::chunk_iterator::ChunkIterator;
|
||||||
|
use super::segment::Segment;
|
||||||
|
|
||||||
|
use super::SpanLinesIterator;
|
||||||
|
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
fn input() -> Vec<Span<'static>> {
|
fn input() -> Vec<Span<'static>> {
|
||||||
vec![
|
vec![
|
||||||
|
@ -4,15 +4,3 @@ mod reader;
|
|||||||
pub mod lines;
|
pub mod lines;
|
||||||
|
|
||||||
pub use self::reader::ProgressReader;
|
pub use self::reader::ProgressReader;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use utils;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_prefix() {
|
|
||||||
assert_eq!(utils::prefix(" abra ".split(' '), 5, " ").length, 5);
|
|
||||||
assert_eq!(utils::prefix("abra a".split(' '), 5, " ").length, 4);
|
|
||||||
assert_eq!(utils::prefix("a a br".split(' '), 5, " ").length, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user