fix: regression that caused TUI tearing when previewing an image

This commit is contained in:
sxyazi 2023-08-20 07:10:10 +08:00
parent bdbd552457
commit 64c6cdf072
No known key found for this signature in database

View File

@ -24,6 +24,10 @@ impl Adaptor {
path = cache.as_path();
}
if IMAGE_SHOWN.swap(true, Ordering::Relaxed) {
Self::image_hide(rect).ok();
}
match PREVIEW.adaptor {
PreviewAdaptor::Kitty => Kitty::image_show(path, rect).await,
PreviewAdaptor::Iterm2 => Iterm2::image_show(path, rect).await,
@ -31,9 +35,7 @@ impl Adaptor {
_ => Ok(if let Some(tx) = &*UEBERZUG {
tx.send(Some((path.to_path_buf(), rect)))?;
}),
}?;
Ok(IMAGE_SHOWN.store(true, Ordering::Relaxed))
}
}
pub fn image_hide(rect: Rect) -> Result<()> {