yazi_widgets/input/commands/
undo.rs

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