mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-23 07:41:03 +00:00
23 lines
464 B
Rust
23 lines
464 B
Rust
use anyhow::Result;
|
|
use yazi_macro::{act, render, succ};
|
|
use yazi_shared::data::Data;
|
|
|
|
use crate::input::{Input, InputMode, op::InputOp, parser::InsertOpt};
|
|
|
|
impl Input {
|
|
pub fn insert(&mut self, opt: InsertOpt) -> Result<Data> {
|
|
let snap = self.snap_mut();
|
|
if snap.mode == InputMode::Normal {
|
|
snap.op = InputOp::None;
|
|
snap.mode = InputMode::Insert;
|
|
} else {
|
|
succ!();
|
|
}
|
|
|
|
if opt.append {
|
|
act!(r#move, self, 1)?;
|
|
}
|
|
|
|
succ!(render!());
|
|
}
|
|
}
|