Explorar o código

Count the number of grapheme clusters to determine the cell length.

nwin %!s(int64=11) %!d(string=hai) anos
pai
achega
df909272a1
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/column.rs

+ 1 - 1
src/column.rs

@@ -86,7 +86,7 @@ impl Cell {
     pub fn paint(style: Style, string: &str) -> Cell {
         Cell {
             text: style.paint(string).to_string(),
-            length: string.len(),
+            length: string.graphemes(true).count(),
         }
     }
 }