mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
25 lines
530 B
Rust
25 lines
530 B
Rust
use anyhow::Result;
|
|
use yazi_macro::{act, succ};
|
|
use yazi_shared::data::Data;
|
|
|
|
use crate::input::{Input, InputMode, op::InputOp};
|
|
|
|
impl Input {
|
|
pub fn escape(&mut self, _: ()) -> Result<Data> {
|
|
let snap = self.snap_mut();
|
|
match snap.mode {
|
|
InputMode::Normal => {
|
|
snap.op = InputOp::None;
|
|
}
|
|
InputMode::Insert => {
|
|
snap.mode = InputMode::Normal;
|
|
act!(r#move, self, -1)?;
|
|
}
|
|
InputMode::Replace => {
|
|
snap.mode = InputMode::Normal;
|
|
}
|
|
}
|
|
self.snaps.tag(self.pos.width as usize);
|
|
succ!();
|
|
}
|
|
}
|