mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Switch to Lua 5.4
This commit is contained in:
parent
f0535ef824
commit
a005f20a9c
3 changed files with 9 additions and 20 deletions
|
|
@ -23,6 +23,7 @@ better-panic = "^0"
|
|||
crossterm = { version = "^0", features = [ "event-stream" ] }
|
||||
fdlimit = "^0"
|
||||
futures = "^0"
|
||||
mlua = { version = "^0", features = [ "lua54", "vendored" ] }
|
||||
ratatui = "^0"
|
||||
tokio = { version = "^1", features = [ "parking_lot" ] }
|
||||
unicode-width = "^0"
|
||||
|
|
@ -36,12 +37,6 @@ tracing-subscriber = "^0"
|
|||
libc = "^0"
|
||||
signal-hook-tokio = { version = "^0", features = [ "futures-v0_3" ] }
|
||||
|
||||
[target.'cfg(any(target_arch="riscv64", target_arch="loongarch64"))'.dependencies]
|
||||
mlua = { version = "^0", features = [ "lua52", "vendored" ] }
|
||||
|
||||
[target.'cfg(not(any(target_arch="riscv64", target_arch="loongarch64")))'.dependencies]
|
||||
mlua = { version = "^0", features = [ "luajit52", "vendored" ] }
|
||||
|
||||
[[bin]]
|
||||
name = "yazi"
|
||||
path = "src/main.rs"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ crossterm = "^0"
|
|||
futures = "^0"
|
||||
libc = "^0"
|
||||
md-5 = "^0"
|
||||
mlua = { version = "^0", features = [ "lua54", "vendored", "serialize", "macros", "async" ] }
|
||||
parking_lot = "^0"
|
||||
ratatui = "^0"
|
||||
serde = "^1"
|
||||
|
|
@ -30,9 +31,3 @@ tokio-util = "^0"
|
|||
tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] }
|
||||
unicode-width = "^0"
|
||||
yazi-prebuild = "^0"
|
||||
|
||||
[target.'cfg(any(target_arch="riscv64", target_arch="loongarch64"))'.dependencies]
|
||||
mlua = { version = "^0", features = [ "lua52", "vendored", "serialize", "macros", "async" ] }
|
||||
|
||||
[target.'cfg(not(any(target_arch="riscv64", target_arch="loongarch64")))'.dependencies]
|
||||
mlua = { version = "^0", features = [ "luajit52", "vendored", "serialize", "macros", "async" ] }
|
||||
|
|
|
|||
|
|
@ -12,19 +12,18 @@ pub fn peek(exec: &Exec, file: yazi_shared::fs::File, skip: usize) -> Cancellati
|
|||
let ct = CancellationToken::new();
|
||||
|
||||
let cmd = exec.cmd.to_owned();
|
||||
let ct2 = ct.clone();
|
||||
let (ct1, ct2) = (ct.clone(), ct.clone());
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let future = async {
|
||||
LOADED.ensure(&cmd).await.into_lua_err()?;
|
||||
|
||||
let lua = slim_lua()?;
|
||||
// FIXME: this will cause a panic
|
||||
// lua.set_hook(
|
||||
// HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000),
|
||||
// move |_, _| {
|
||||
// if ct1.is_cancelled() { Err("cancelled".into_lua_err()) } else { Ok(()) }
|
||||
// },
|
||||
// );
|
||||
lua.set_hook(
|
||||
HookTriggers::new().on_calls().on_returns().every_nth_instruction(2000),
|
||||
move |_, _| {
|
||||
if ct1.is_cancelled() { Err("cancelled".into_lua_err()) } else { Ok(()) }
|
||||
},
|
||||
);
|
||||
|
||||
let plugin: Table = if let Some(b) = LOADED.read().get(&cmd) {
|
||||
lua.load(b).call(())?
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue