diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-05 10:26:19 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-05 10:26:19 -0500 |
commit | 665238f5318bee40f254fe43aa158e61bdd25392 (patch) | |
tree | 19d2c6828a6263ec3b2b9ee44363774ecdaaca5c /src/row.rs | |
parent | b24d69d51b3567f75630bb1b3a6875dac6e1c647 (diff) | |
download | vt100-rust-665238f5318bee40f254fe43aa158e61bdd25392.tar.gz vt100-rust-665238f5318bee40f254fe43aa158e61bdd25392.zip |
contents_formatted should return a Vec<u8>
the overall terminal escape sequence byte stream is not necessarily
utf8-safe, even if individual cell contents are
Diffstat (limited to 'src/row.rs')
-rw-r--r-- | src/row.rs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -91,9 +91,9 @@ impl Row { col_start: u16, col_end: u16, attrs: crate::attrs::Attrs, - ) -> (String, crate::attrs::Attrs) { + ) -> (Vec<u8>, crate::attrs::Attrs) { let mut prev_was_wide = false; - let mut contents = String::new(); + let mut contents = vec![]; let mut prev_attrs = attrs; if let Some(max_col) = self.max_col() { for col in col_start..=(col_end.min(max_col)) { @@ -106,7 +106,7 @@ impl Row { let attrs = cell.attrs(); if &prev_attrs != attrs { - contents += &attrs.escape_code_diff(&prev_attrs); + contents.append(&mut attrs.escape_code_diff(&prev_attrs)); prev_attrs = *attrs; } @@ -116,13 +116,13 @@ impl Row { } else { cell_contents }; - contents += cell_contents; + contents.extend(cell_contents.as_bytes()); prev_was_wide = cell.is_wide(); } } if !self.wrapped { - contents += "\r\n"; + contents.extend(b"\r\n"); } (contents, prev_attrs) } |