StyledBuffer::prepend: if line is empty, insert content without inserting spaces
This commit is contained in:
parent
e97ddedac6
commit
7e9d3c6f6c
1 changed files with 5 additions and 3 deletions
|
@ -105,10 +105,12 @@ impl StyledBuffer {
|
||||||
self.ensure_lines(line);
|
self.ensure_lines(line);
|
||||||
let string_len = string.chars().count();
|
let string_len = string.chars().count();
|
||||||
|
|
||||||
|
if !self.text[line].is_empty() {
|
||||||
// Push the old content over to make room for new content
|
// Push the old content over to make room for new content
|
||||||
for _ in 0..string_len {
|
for _ in 0..string_len {
|
||||||
self.text[line].insert(0, StyledChar::default());
|
self.text[line].insert(0, StyledChar::default());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.puts(line, 0, string, style);
|
self.puts(line, 0, string, style);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue