mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Correctly estimate required space for string
`.len()` returns length in bytes so it overestimates the required space
This commit is contained in:
parent
2e7244807a
commit
4414068cc4
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user