Skip to content

Commit

Permalink
Correctly estimate required space for string
Browse files Browse the repository at this point in the history
`.len()` returns length in bytes so it overestimates the required space
  • Loading branch information
AnthonyMikh committed Oct 5, 2019
1 parent 2e72448 commit 4414068
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_errors/styled_buffer.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 4414068

Please sign in to comment.