fix: reset image rendering and skip peeking if the TUI in the background (#1833)

This commit is contained in:
三咲雅 · Misaki Masa 2024-10-25 16:52:57 +08:00 committed by GitHub
parent 60cfa7dba9
commit 56f9a6a1eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,4 @@
use yazi_proxy::HIDER;
use yazi_shared::{event::{Cmd, Data}, fs::Url};
use crate::manager::Manager;
@ -30,6 +31,9 @@ impl Manager {
let Some(hovered) = self.hovered().cloned() else {
return self.active_mut().preview.reset();
};
if HIDER.try_acquire().is_err() {
return self.active_mut().preview.reset_image();
}
let mime = self.mimetype.get_owned(&hovered.url).unwrap_or_default();
let folder = self.active().hovered_folder().map(|f| (f.offset, f.cha));