diff --git a/yazi-core/src/which/commands/callback.rs b/yazi-core/src/which/commands/callback.rs index 9bcae59c..7dd4100c 100644 --- a/yazi-core/src/which/commands/callback.rs +++ b/yazi-core/src/which/commands/callback.rs @@ -1,4 +1,5 @@ use tokio::sync::mpsc; +use tracing::error; use yazi_shared::event::Cmd; use crate::which::Which; @@ -21,8 +22,12 @@ impl TryFrom for Opt { impl Which { pub fn callback(&mut self, opt: impl TryInto) { - if let Ok(opt) = opt.try_into() { - opt.tx.try_send(opt.idx).ok(); + let Ok(opt) = opt.try_into() else { + return; + }; + + if opt.tx.try_send(opt.idx).is_err() { + error!("callback: send error"); } } } diff --git a/yazi-plugin/src/utils/layer.rs b/yazi-plugin/src/utils/layer.rs index 86845d01..d953d48f 100644 --- a/yazi-plugin/src/utils/layer.rs +++ b/yazi-plugin/src/utils/layer.rs @@ -49,7 +49,7 @@ impl Utils { Layer::Which )); - Ok(rx.recv().await) + Ok(rx.recv().await.map(|idx| idx + 1)) })?, )?;