Skip to content

Commit

Permalink
implement code review
Browse files Browse the repository at this point in the history
  • Loading branch information
happenslol committed Aug 2, 2022
1 parent d6523a3 commit 02588ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 90 deletions.
81 changes: 0 additions & 81 deletions examples/multi-log.rs

This file was deleted.

17 changes: 8 additions & 9 deletions src/style.rs
Expand Up @@ -374,17 +374,16 @@ impl ProgressStyle {
None => mem::take(cur),
};

// If cur doesn't contain any newlines now, we can add
// the line as is.
if !expanded.contains('\n') {
lines.push(expanded);
return;
}

// However, if there are newlines, we need to split them up
// If there are newlines, we need to split them up
// and add the lines separately so that they're counted
// correctly on re-render.
for line in expanded.split('\n') {
for (i, line) in expanded.split('\n').enumerate() {
// No newlines found in this case
if i == 0 && line.len() == expanded.len() {
lines.push(expanded);
break;
}

lines.push(line.to_string());
}
}
Expand Down

0 comments on commit 02588ff

Please sign in to comment.