1
Fork 0

StyledBuffer::prepend: if line is empty, insert content without inserting spaces

This commit is contained in:
klensy 2021-04-16 05:11:45 +03:00
parent e97ddedac6
commit 7e9d3c6f6c

View file

@ -105,9 +105,11 @@ impl StyledBuffer {
self.ensure_lines(line); self.ensure_lines(line);
let string_len = string.chars().count(); let string_len = string.chars().count();
// Push the old content over to make room for new content if !self.text[line].is_empty() {
for _ in 0..string_len { // Push the old content over to make room for new content
self.text[line].insert(0, StyledChar::default()); for _ in 0..string_len {
self.text[line].insert(0, StyledChar::default());
}
} }
self.puts(line, 0, string, style); self.puts(line, 0, string, style);