Remove the last character in the render buffer on backspace
This commit is contained in:
parent
cce162bd72
commit
104da286b1
10
src/main.rs
10
src/main.rs
@ -263,11 +263,17 @@ impl FramebufferWriter {
|
|||||||
|
|
||||||
impl fmt::Write for FramebufferWriter {
|
impl fmt::Write for FramebufferWriter {
|
||||||
fn write_char(&mut self, c: char) -> fmt::Result {
|
fn write_char(&mut self, c: char) -> fmt::Result {
|
||||||
self.out_string.push(c);
|
if c == '\u{8}' {
|
||||||
|
self.out_string.pop();
|
||||||
|
} else {
|
||||||
|
self.out_string.push(c);
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn write_str(&mut self, s: &str) -> core::fmt::Result {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user