mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
36 lines
704 B
Rust
36 lines
704 B
Rust
use yazi_shared::event::Exec;
|
|
|
|
use crate::{completion::Completion, input::{op::InputOp, Input, InputMode}};
|
|
|
|
pub struct Opt;
|
|
|
|
impl From<&Exec> for Opt {
|
|
fn from(_: &Exec) -> Self { Self }
|
|
}
|
|
impl From<()> for Opt {
|
|
fn from(_: ()) -> Self { Self }
|
|
}
|
|
|
|
impl Input {
|
|
pub fn escape(&mut self, _: impl Into<Opt>) -> bool {
|
|
let snap = self.snap_mut();
|
|
match snap.mode {
|
|
InputMode::Normal if snap.op == InputOp::None => {
|
|
self.close(false);
|
|
}
|
|
InputMode::Normal => {
|
|
snap.op = InputOp::None;
|
|
}
|
|
InputMode::Insert => {
|
|
snap.mode = InputMode::Normal;
|
|
self.move_(-1);
|
|
|
|
if self.completion {
|
|
Completion::_close();
|
|
}
|
|
}
|
|
}
|
|
self.snaps.tag(self.limit());
|
|
true
|
|
}
|
|
}
|