yazi_widgets/input/actor/undo.rs
1use anyhow::Result;
2use yazi_macro::{act, render, succ};
3use yazi_shared::data::Data;
4
5use crate::input::{Input, InputMode, InputOp};
6
7impl Input {
8 pub fn undo(&mut self, _: ()) -> Result<Data> {
9 if self.snap().op != InputOp::None {
10 succ!();
11 }
12
13 if !self.snaps.undo() {
14 succ!();
15 }
16
17 act!(r#move, self)?;
18 if self.snap().mode == InputMode::Insert {
19 act!(escape, self)?;
20 }
21
22 succ!(render!());
23 }
24}