fix: clear Sixel image with empty characters instead of \x2B[K to be compatible with GNOME VTE (#309)

This commit is contained in:
linsui 2023-10-23 08:20:21 +00:00 committed by GitHub
parent bfc1dcb4f6
commit 55187496fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,10 +21,11 @@ impl Sixel {
pub(super) fn image_hide(rect: Rect) -> Result<()> {
let stdout = BufWriter::new(stdout().lock());
let s = " ".repeat(rect.width as usize);
Term::move_lock(stdout, (0, 0), |stdout| {
for y in rect.top()..rect.bottom() {
Term::move_to(stdout, rect.x, y)?;
Term::kill_to_end(stdout)?;
stdout.write_all(s.as_bytes())?;
}
Ok(())
})