diff options
author | James Campos <james.r.campos@gmail.com> | 2020-04-22 22:30:09 -0700 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-04-22 22:30:09 -0700 |
commit | 616b886a63060d80b3c463744769bdfc0f30504c (patch) | |
tree | 69bf69f506d27b27f64ab5ba805c10874f638f2b | |
parent | ff50306ef4da95c2126996eb45f4919549b2730e (diff) | |
download | bk-616b886a63060d80b3c463744769bdfc0f30504c.tar.gz |
OBOE
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 4c66133..9d96dfe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,16 +101,18 @@ fn wrap(text: Vec<String>, width: u16) -> Vec<String> { let mut word = 0; for (i, c) in chunk.char_indices() { - line += 1; - word += 1; if c == ' ' { space = i; word = 0; + } else { + word += 1; } if line == width { wrapped.push(String::from(&chunk[start..space])); start = space + 1; line = word; + } else { + line += 1; } } wrapped.push(String::from(&chunk[start..])); |