aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-04-22 22:30:09 -0700
committerJames Campos <james.r.campos@gmail.com>2020-04-22 22:30:09 -0700
commit616b886a63060d80b3c463744769bdfc0f30504c (patch)
tree69bf69f506d27b27f64ab5ba805c10874f638f2b
parentff50306ef4da95c2126996eb45f4919549b2730e (diff)
downloadbk-616b886a63060d80b3c463744769bdfc0f30504c.tar.gz
OBOE
-rw-r--r--src/main.rs6
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..]));