mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
27 lines
573 B
Rust
27 lines
573 B
Rust
use anyhow::Result;
|
|
use yazi_macro::succ;
|
|
use yazi_parser::app::StopForm;
|
|
use yazi_shared::data::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct Stop;
|
|
|
|
impl Actor for Stop {
|
|
type Form = StopForm;
|
|
|
|
const NAME: &str = "stop";
|
|
|
|
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
|
cx.active_mut().preview.reset_image();
|
|
|
|
// We need to destroy the `term` first before stopping the `signals`
|
|
// to prevent any signal from triggering the term to render again
|
|
// while the app is being suspended.
|
|
*cx.term = None;
|
|
|
|
opt.tx.send((false, opt.token))?;
|
|
|
|
succ!();
|
|
}
|
|
}
|