diff options
| author | James Campos <james.r.campos@gmail.com> | 2020-05-16 02:22:35 -0700 | 
|---|---|---|
| committer | James Campos <james.r.campos@gmail.com> | 2020-05-16 02:22:35 -0700 | 
| commit | d09560fa20287e5033cca5229649eac140f81e63 (patch) | |
| tree | 5813ff0bc2d44671486c95592957d1d744f6a9f6 /src/main.rs | |
| parent | 9b6d9dcf8b5c538fcbd291eda081302189b8ea84 (diff) | |
| download | bk-d09560fa20287e5033cca5229649eac140f81e63.tar.gz | |
meta
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/main.rs b/src/main.rs index 9c27522..ee50d78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use crossterm::{  };  mod epub; -use epub::Epub;  fn wrap(text: &str, width: usize) -> Vec<(usize, String)> {      // XXX assumes a char is 1 unit wide @@ -301,9 +300,10 @@ struct Bk<'a> {  }  impl Bk<'_> { -    fn new(epub: Epub, line: &Position, max_width: u16) -> Self { +    fn new(epub: epub::Epub, line: &Position, max_width: u16) -> Self {          let (cols, rows) = terminal::size().unwrap();          let width = std::cmp::min(cols, max_width) as usize; +          let mut chapters = Vec::with_capacity(epub.chapters.len());          for text in epub.chapters {              let wrap = wrap(&text, width); @@ -467,7 +467,7 @@ fn main() {          std::process::exit(1);      }); -    let epub = Epub::new(&line.0).unwrap_or_else(|e| { +    let epub = epub::Epub::new(&line.0).unwrap_or_else(|e| {          println!("error reading epub: {}", e);          std::process::exit(1);      }); | 
