Skip to content

Commit

Permalink
worksheet: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnamara committed Oct 3, 2023
1 parent 0f27609 commit 8ad7720
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/worksheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7774,16 +7774,12 @@ impl Worksheet {
| CellType::RichString {
raw_string: string, ..
} => {
if string.contains('\n') {
let mut max = 0;
for segment in string.split('\n') {
let length = utility::pixel_width(segment);
max = cmp::max(max, length);
}
max
} else {
utility::pixel_width(string)
let mut max = 0;
for segment in string.lines() {
let length = utility::pixel_width(segment);
max = cmp::max(max, length);
}
max
}

// For numbers we use a workaround/optimization
Expand Down

0 comments on commit 8ad7720

Please sign in to comment.