Remove the last character in the render buffer on backspace

This commit is contained in:
pjht 2024-09-11 13:49:17 -05:00
parent cce162bd72
commit 104da286b1
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -263,11 +263,17 @@ impl FramebufferWriter {
impl fmt::Write for FramebufferWriter {
fn write_char(&mut self, c: char) -> fmt::Result {
if c == '\u{8}' {
self.out_string.pop();
} else {
self.out_string.push(c);
}
Ok(())
}
fn write_str(&mut self, s: &str) -> core::fmt::Result {
self.out_string.push_str(s);
for c in s.chars() {
self.write_char(c)?;
}
Ok(())
}
}