diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-03-22 10:38:38 +0800 |
---|---|---|
committer | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-03-22 10:38:38 +0800 |
commit | 56244adfef75d2006415ba6b018c8eebbde91b89 (patch) | |
tree | ff9c94bc1fb2aed63ed06f8014f8242d429c5c34 | |
parent | acfcf78771598b9ad8c29c0aa1456a046e7bc2b0 (diff) |
fix: make the code deal with more than just 2 width
-rw-r--r-- | svgbob/src/buffer/string_buffer.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/svgbob/src/buffer/string_buffer.rs b/svgbob/src/buffer/string_buffer.rs index a0c6280..cb54cdd 100644 --- a/svgbob/src/buffer/string_buffer.rs +++ b/svgbob/src/buffer/string_buffer.rs @@ -77,10 +77,11 @@ impl From<&str> for StringBuffer { for line in s.lines() { let mut row = vec![]; for ch in line.chars() { - // TODO: deal with multi-width , zero width, fixed with string row.push(ch); - if let Some(2) = ch.width() { - row.push('\0'); + if let Some(width) = ch.width() { + for i in 1..width { + row.push('\0'); + } } } rows.push(row); |