added default for StyledChar
This commit is contained in:
parent
756be4a052
commit
f5229916e3
1 changed files with 8 additions and 2 deletions
|
@ -19,6 +19,12 @@ impl StyledChar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for StyledChar {
|
||||||
|
fn default() -> Self {
|
||||||
|
StyledChar::new(' ', Style::NoStyle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl StyledBuffer {
|
impl StyledBuffer {
|
||||||
pub fn new() -> StyledBuffer {
|
pub fn new() -> StyledBuffer {
|
||||||
StyledBuffer { text: vec![] }
|
StyledBuffer { text: vec![] }
|
||||||
|
@ -71,7 +77,7 @@ impl StyledBuffer {
|
||||||
} else {
|
} else {
|
||||||
let mut i = self.text[line].len();
|
let mut i = self.text[line].len();
|
||||||
while i < col {
|
while i < col {
|
||||||
self.text[line].push(StyledChar::new(' ', Style::NoStyle));
|
self.text[line].push(StyledChar::default());
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
self.text[line].push(StyledChar::new(chr, style));
|
self.text[line].push(StyledChar::new(chr, style));
|
||||||
|
@ -92,7 +98,7 @@ impl StyledBuffer {
|
||||||
|
|
||||||
// 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::new(' ', Style::NoStyle));
|
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