fix: reset image rendering and skip peeking if the TUI in the background

This commit is contained in:
sxyazi 2024-10-25 16:50:17 +08:00
parent 60cfa7dba9
commit d1503654a7
No known key found for this signature in database

View file

@ -1,3 +1,4 @@
use yazi_proxy::HIDER;
use yazi_shared::{event::{Cmd, Data}, fs::Url};
use crate::manager::Manager;
@ -27,6 +28,10 @@ impl From<bool> for Opt {
impl Manager {
#[yazi_codegen::command]
pub fn peek(&mut self, opt: Opt) {
if HIDER.try_acquire().is_err() {
return self.active_mut().preview.reset_image();
}
let Some(hovered) = self.hovered().cloned() else {
return self.active_mut().preview.reset();
};