Correctly estimate required space for string

`.len()` returns length in bytes so it overestimates the required space
This commit is contained in:
AnthonyMikh 2019-10-05 03:08:05 +03:00 committed by GitHub
parent 2e7244807a
commit 4414068cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,7 @@ impl StyledBuffer {
pub fn prepend(&mut self, line: usize, string: &str, style: Style) {
self.ensure_lines(line);
let string_len = string.len();
let string_len = string.chars().count();
// Push the old content over to make room for new content
for _ in 0..string_len {