mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 00:31:04 +00:00
21 lines
615 B
Rust
21 lines
615 B
Rust
use mlua::TableExt;
|
|
use yazi_config::LAYOUT;
|
|
use yazi_shared::{emit, event::Exec, Layer};
|
|
|
|
use crate::{bindings::{Cast, File}, elements::Rect, OptData, LUA};
|
|
|
|
pub fn seek_sync(exec: &Exec, file: yazi_shared::fs::File, units: i16) {
|
|
let data = OptData {
|
|
args: vec![],
|
|
cb: Some(Box::new(move |plugin| {
|
|
plugin.set("file", File::cast(&LUA, file)?)?;
|
|
plugin.set("area", Rect::cast(&LUA, LAYOUT.load().preview)?)?;
|
|
plugin.call_method("seek", units)
|
|
})),
|
|
tx: None,
|
|
};
|
|
emit!(Call(
|
|
Exec::call("plugin", vec![exec.cmd.to_owned()]).with_bool("sync", true).with_data(data).vec(),
|
|
Layer::App
|
|
));
|
|
}
|