aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cell.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 45e795b..95d047e 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -64,7 +64,11 @@ impl Cell {
/// used, but will contain at most one character with a non-zero character
/// width.
pub fn contents(&self) -> String {
- self.contents.iter().take(self.len()).collect::<String>()
+ let mut s = String::with_capacity(CODEPOINTS_IN_CELL * 4);
+ for c in self.contents.iter().take(self.len()) {
+ s.push(*c);
+ }
+ s
}
/// Returns whether the cell contains any text data.