feat: new which:dismiss command to dismiss the which component (#3654)

This commit is contained in:
三咲雅 misaki masa 2026-02-02 02:53:02 +08:00 committed by GitHub
parent 339002ee48
commit 6757fed5aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 370 additions and 366 deletions

124
Cargo.lock generated
View file

@ -485,9 +485,9 @@ checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.24.0" version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
dependencies = [ dependencies = [
"bytemuck_derive", "bytemuck_derive",
] ]
@ -541,9 +541,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.54" version = "1.2.55"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"jobserver", "jobserver",
@ -600,9 +600,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.55" version = "4.5.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e34525d5bbbd55da2bb745d34b36121baac88d07619a9a09cfcf4a6c0832785" checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -610,9 +610,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.55" version = "4.5.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a20016a20a3da95bef50ec7238dbd09baeef4311dcdd38ec15aba69812fb61" checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -920,9 +920,9 @@ dependencies = [
[[package]] [[package]]
name = "crypto-common" name = "crypto-common"
version = "0.2.0-rc.13" version = "0.2.0-rc.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7722afd27468475c9b6063dc03a57ef2ca833816981619f8ebe64d38d207eef" checksum = "5569e5de27d32e673283717728eb5b0e4f30898b523f151a19c51e6188006599"
dependencies = [ dependencies = [
"hybrid-array", "hybrid-array",
] ]
@ -1240,13 +1240,13 @@ dependencies = [
[[package]] [[package]]
name = "digest" name = "digest"
version = "0.11.0-rc.9" version = "0.11.0-rc.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff8de092798697546237a3a701e4174fe021579faec9b854379af9bf1e31962" checksum = "afa94b64bfc6549e6e4b5a3216f22593224174083da7a90db47e951c4fb31725"
dependencies = [ dependencies = [
"block-buffer 0.11.0", "block-buffer 0.11.0",
"const-oid 0.10.2", "const-oid 0.10.2",
"crypto-common 0.2.0-rc.13", "crypto-common 0.2.0-rc.14",
] ]
[[package]] [[package]]
@ -1546,9 +1546,9 @@ dependencies = [
[[package]] [[package]]
name = "find-msvc-tools" name = "find-msvc-tools"
version = "0.1.8" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]] [[package]]
name = "finl_unicode" name = "finl_unicode"
@ -2064,7 +2064,7 @@ checksum = "fe44f2bbd99fcb302e246e2d6bcf51aeda346d02a365f80296a07a8c711b6da6"
dependencies = [ dependencies = [
"argon2", "argon2",
"bcrypt-pbkdf", "bcrypt-pbkdf",
"digest 0.11.0-rc.9", "digest 0.11.0-rc.10",
"ecdsa", "ecdsa",
"ed25519-dalek", "ed25519-dalek",
"hex", "hex",
@ -3199,9 +3199,9 @@ dependencies = [
[[package]] [[package]]
name = "portable-atomic" name = "portable-atomic"
version = "1.13.0" version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
[[package]] [[package]]
name = "powerfmt" name = "powerfmt"
@ -3692,7 +3692,7 @@ dependencies = [
"const-oid 0.10.2", "const-oid 0.10.2",
"crypto-bigint 0.7.0-rc.18", "crypto-bigint 0.7.0-rc.18",
"crypto-primes", "crypto-primes",
"digest 0.11.0-rc.9", "digest 0.11.0-rc.10",
"pkcs1", "pkcs1",
"pkcs8 0.11.0-rc.10", "pkcs8 0.11.0-rc.10",
"rand_core 0.10.0-rc-3", "rand_core 0.10.0-rc-3",
@ -3888,9 +3888,9 @@ dependencies = [
[[package]] [[package]]
name = "schemars" name = "schemars"
version = "1.2.0" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"
dependencies = [ dependencies = [
"dyn-clone", "dyn-clone",
"ref-cast", "ref-cast",
@ -4009,7 +4009,7 @@ dependencies = [
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.13.0", "indexmap 2.13.0",
"schemars 0.9.0", "schemars 0.9.0",
"schemars 1.2.0", "schemars 1.2.1",
"serde_core", "serde_core",
"serde_json", "serde_json",
"serde_with_macros", "serde_with_macros",
@ -4057,7 +4057,7 @@ checksum = "9c777f0a122a53fddb0beb6e706771197000b8eb5c9f42b5b850f450ef48c788"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"cpufeatures", "cpufeatures",
"digest 0.11.0-rc.9", "digest 0.11.0-rc.10",
] ]
[[package]] [[package]]
@ -4079,7 +4079,7 @@ checksum = "7535f94fa3339fe9e5e9be6260a909e62af97f6e14b32345ccf79b92b8b81233"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"cpufeatures", "cpufeatures",
"digest 0.11.0-rc.9", "digest 0.11.0-rc.10",
] ]
[[package]] [[package]]
@ -4166,7 +4166,7 @@ version = "3.0.0-rc.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a96996ccff7dfa16f052bd995b4cecc72af22c35138738dc029f0ead6608d" checksum = "597a96996ccff7dfa16f052bd995b4cecc72af22c35138738dc029f0ead6608d"
dependencies = [ dependencies = [
"digest 0.11.0-rc.9", "digest 0.11.0-rc.10",
"rand_core 0.10.0-rc-3", "rand_core 0.10.0-rc-3",
] ]
@ -4199,9 +4199,9 @@ checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.11" version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
@ -5534,7 +5534,7 @@ checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
[[package]] [[package]]
name = "yazi-actor" name = "yazi-actor"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -5571,7 +5571,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-adapter" name = "yazi-adapter"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"ansi-to-tui", "ansi-to-tui",
"anyhow", "anyhow",
@ -5594,7 +5594,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-binding" name = "yazi-binding"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"ansi-to-tui", "ansi-to-tui",
"anyhow", "anyhow",
@ -5621,7 +5621,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-boot" name = "yazi-boot"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"clap", "clap",
"clap_complete", "clap_complete",
@ -5642,14 +5642,14 @@ dependencies = [
[[package]] [[package]]
name = "yazi-build" name = "yazi-build"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"yazi-tty", "yazi-tty",
] ]
[[package]] [[package]]
name = "yazi-cli" name = "yazi-cli"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -5673,7 +5673,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-codegen" name = "yazi-codegen"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.114", "syn 2.0.114",
@ -5681,7 +5681,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-config" name = "yazi-config"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bitflags 2.10.0", "bitflags 2.10.0",
@ -5705,7 +5705,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-core" name = "yazi-core"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -5719,6 +5719,7 @@ dependencies = [
"tracing", "tracing",
"unicode-width", "unicode-width",
"yazi-adapter", "yazi-adapter",
"yazi-binding",
"yazi-config", "yazi-config",
"yazi-dds", "yazi-dds",
"yazi-emulator", "yazi-emulator",
@ -5736,7 +5737,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-dds" name = "yazi-dds"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"hashbrown 0.16.1", "hashbrown 0.16.1",
@ -5762,7 +5763,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-emulator" name = "yazi-emulator"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -5777,7 +5778,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-ffi" name = "yazi-ffi"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"core-foundation-sys", "core-foundation-sys",
@ -5788,7 +5789,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-fm" name = "yazi-fm"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"better-panic", "better-panic",
@ -5830,7 +5831,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-fs" name = "yazi-fs"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"arc-swap", "arc-swap",
@ -5862,15 +5863,15 @@ dependencies = [
[[package]] [[package]]
name = "yazi-macro" name = "yazi-macro"
version = "26.1.22" version = "26.2.2"
[[package]] [[package]]
name = "yazi-packing" name = "yazi-packing"
version = "26.1.22" version = "26.2.2"
[[package]] [[package]]
name = "yazi-parser" name = "yazi-parser"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bitflags 2.10.0", "bitflags 2.10.0",
@ -5895,7 +5896,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-plugin" name = "yazi-plugin"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -5941,9 +5942,10 @@ checksum = "33232d9116df6415ddfcdf72701b1b7439ce87f240a14723e8dd5d17e7ed5f98"
[[package]] [[package]]
name = "yazi-proxy" name = "yazi-proxy"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"tokio", "tokio",
"yazi-binding",
"yazi-config", "yazi-config",
"yazi-macro", "yazi-macro",
"yazi-parser", "yazi-parser",
@ -5953,7 +5955,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-scheduler" name = "yazi-scheduler"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-priority-channel", "async-priority-channel",
@ -5982,7 +5984,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-sftp" name = "yazi-sftp"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"bitflags 2.10.0", "bitflags 2.10.0",
"parking_lot", "parking_lot",
@ -5994,7 +5996,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-shared" name = "yazi-shared"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -6018,7 +6020,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-shim" name = "yazi-shim"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"crossterm 0.29.0", "crossterm 0.29.0",
"twox-hash", "twox-hash",
@ -6027,7 +6029,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-term" name = "yazi-term"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossterm 0.29.0", "crossterm 0.29.0",
@ -6043,7 +6045,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-tty" name = "yazi-tty"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"libc", "libc",
"parking_lot", "parking_lot",
@ -6055,7 +6057,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-vfs" name = "yazi-vfs"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deadpool", "deadpool",
@ -6076,7 +6078,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-watcher" name = "yazi-watcher"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"hashbrown 0.16.1", "hashbrown 0.16.1",
@ -6097,7 +6099,7 @@ dependencies = [
[[package]] [[package]]
name = "yazi-widgets" name = "yazi-widgets"
version = "26.1.22" version = "26.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -6118,18 +6120,18 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.35" version = "0.8.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572" checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.8.35" version = "0.8.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22" checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -6158,9 +6160,9 @@ dependencies = [
[[package]] [[package]]
name = "zmij" name = "zmij"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" checksum = "1966f8ac2c1f76987d69a74d0e0f929241c10e78136434e3be70ff7f58f64214"
[[package]] [[package]]
name = "zune-core" name = "zune-core"

View file

@ -30,7 +30,7 @@ ansi-to-tui = "8.0.1"
anyhow = "1.0.100" anyhow = "1.0.100"
base64 = "0.22.1" base64 = "0.22.1"
bitflags = { version = "2.10.0", features = [ "serde" ] } bitflags = { version = "2.10.0", features = [ "serde" ] }
clap = { version = "4.5.55", features = [ "derive" ] } clap = { version = "4.5.56", features = [ "derive" ] }
core-foundation-sys = "0.8.7" core-foundation-sys = "0.8.7"
crossterm = { version = "0.29.0", features = [ "event-stream" ] } crossterm = { version = "0.29.0", features = [ "event-stream" ] }
dirs = "6.0.0" dirs = "6.0.0"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-actor" name = "yazi-actor"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -16,24 +16,24 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-core = { path = "../yazi-core", version = "26.1.22" } yazi-core = { path = "../yazi-core", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" } yazi-plugin = { path = "../yazi-plugin", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-scheduler = { path = "../yazi-scheduler", version = "26.1.22" } yazi-scheduler = { path = "../yazi-scheduler", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-term = { path = "../yazi-term", version = "26.1.22" } yazi-term = { path = "../yazi-term", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" } yazi-watcher = { path = "../yazi-watcher", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -36,7 +36,7 @@ impl Actor for PluginDo {
let blocking = runtime_mut!(LUA)?.critical_push(&opt.id, true); let blocking = runtime_mut!(LUA)?.critical_push(&opt.id, true);
defer! { _ = runtime_mut!(LUA).map(|mut r| r.critical_pop(blocking)) } defer! { _ = runtime_mut!(LUA).map(|mut r| r.critical_pop(blocking)) }
let plugin = match LOADER.load_with(&LUA, &opt.id, chunk) { let plugin = match LOADER.load_chunk(&LUA, &opt.id, chunk) {
Ok(t) => t, Ok(t) => t,
Err(e) => succ!(warn!("{e}")), Err(e) => succ!(warn!("{e}")),
}; };

View file

@ -8,6 +8,7 @@ use super::{Lives, PtrCell};
pub(super) struct Which { pub(super) struct Which {
inner: PtrCell<yazi_core::which::Which>, inner: PtrCell<yazi_core::which::Which>,
v_tx: Option<Value>,
v_cands: Option<Value>, v_cands: Option<Value>,
} }
@ -19,12 +20,13 @@ impl Deref for Which {
impl Which { impl Which {
pub(super) fn make(inner: &yazi_core::which::Which) -> mlua::Result<AnyUserData> { pub(super) fn make(inner: &yazi_core::which::Which) -> mlua::Result<AnyUserData> {
Lives::scoped_userdata(Self { inner: inner.into(), v_cands: None }) Lives::scoped_userdata(Self { inner: inner.into(), v_tx: None, v_cands: None })
} }
} }
impl UserData for Which { impl UserData for Which {
fn add_fields<F: UserDataFields<Self>>(fields: &mut F) { fn add_fields<F: UserDataFields<Self>>(fields: &mut F) {
cached_field!(fields, tx, |_, me| Ok(me.tx.clone().map(yazi_binding::MpscUnboundedTx)));
fields.add_field_method_get("times", |_, me| Ok(me.inner.times)); fields.add_field_method_get("times", |_, me| Ok(me.inner.times));
cached_field!(fields, cands, |lua, me| { cached_field!(fields, cands, |lua, me| {
lua.create_sequence_from(me.inner.cands.iter().cloned().map(yazi_binding::ChordCow)) lua.create_sequence_from(me.inner.cands.iter().cloned().map(yazi_binding::ChordCow))

View file

@ -23,6 +23,7 @@ impl Actor for Activate {
} }
let which = &mut cx.which; let which = &mut cx.which;
which.tx = opt.tx;
which.times = opt.times; which.times = opt.times;
which.cands = opt.cands; which.cands = opt.cands;

View file

@ -1,19 +0,0 @@
use anyhow::Result;
use yazi_macro::succ;
use yazi_parser::which::CallbackOpt;
use yazi_shared::data::Data;
use crate::{Actor, Ctx};
pub struct Callback;
impl Actor for Callback {
type Options = CallbackOpt;
const NAME: &str = "callback";
fn act(_: &mut Ctx, opt: Self::Options) -> Result<Data> {
opt.tx.send(opt.idx)?;
succ!();
}
}

View file

@ -0,0 +1,18 @@
use anyhow::Result;
use yazi_macro::succ;
use yazi_parser::VoidOpt;
use yazi_shared::data::Data;
use crate::{Actor, Ctx};
pub struct Dismiss;
impl Actor for Dismiss {
type Options = VoidOpt;
const NAME: &str = "dismiss";
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
succ!(cx.which.dismiss(None));
}
}

View file

@ -1 +1 @@
yazi_macro::mod_flat!(activate callback); yazi_macro::mod_flat!(activate dismiss);

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-adapter" name = "yazi-adapter"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,12 +12,12 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
# External dependencies # External dependencies
ansi-to-tui = { workspace = true } ansi-to-tui = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-binding" name = "yazi-binding"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -16,14 +16,14 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-codegen = { path = "../yazi-codegen", version = "26.1.22" } yazi-codegen = { path = "../yazi-codegen", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
ansi-to-tui = { workspace = true } ansi-to-tui = { workspace = true }

View file

@ -1,14 +1,16 @@
use mlua::{ExternalError, IntoLuaMulti, UserData, Value}; use mlua::{ExternalError, FromLua, IntoLua, IntoLuaMulti, UserData, Value};
use yazi_codegen::FromLuaOwned;
use crate::Error; use crate::Error;
pub struct MpscTx(pub tokio::sync::mpsc::Sender<Value>); #[derive(FromLuaOwned)]
pub struct MpscRx(pub tokio::sync::mpsc::Receiver<Value>); pub struct MpscTx<T: FromLua + 'static>(pub tokio::sync::mpsc::Sender<T>);
pub struct MpscRx<T: IntoLua + 'static>(pub tokio::sync::mpsc::Receiver<T>);
impl UserData for MpscTx { impl<T: FromLua> UserData for MpscTx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_async_method("send", |lua, me, value: Value| async move { methods.add_async_method("send", |lua, me, value: Value| async move {
match me.0.send(value).await { match me.0.send(T::from_lua(value, &lua)?).await {
Ok(()) => true.into_lua_multi(&lua), Ok(()) => true.into_lua_multi(&lua),
Err(e) => (false, Error::custom(e.to_string())).into_lua_multi(&lua), Err(e) => (false, Error::custom(e.to_string())).into_lua_multi(&lua),
} }
@ -16,7 +18,7 @@ impl UserData for MpscTx {
} }
} }
impl UserData for MpscRx { impl<T: IntoLua + 'static> UserData for MpscRx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_async_method_mut("recv", |lua, mut me, ()| async move { methods.add_async_method_mut("recv", |lua, mut me, ()| async move {
match me.0.recv().await { match me.0.recv().await {
@ -27,19 +29,20 @@ impl UserData for MpscRx {
} }
} }
pub struct MpscUnboundedTx(pub tokio::sync::mpsc::UnboundedSender<Value>); #[derive(FromLuaOwned)]
pub struct MpscUnboundedRx(pub tokio::sync::mpsc::UnboundedReceiver<Value>); pub struct MpscUnboundedTx<T: FromLua + 'static>(pub tokio::sync::mpsc::UnboundedSender<T>);
pub struct MpscUnboundedRx<T: IntoLua + 'static>(pub tokio::sync::mpsc::UnboundedReceiver<T>);
impl UserData for MpscUnboundedTx { impl<T: FromLua> UserData for MpscUnboundedTx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_method("send", |lua, me, value: Value| match me.0.send(value) { methods.add_method("send", |lua, me, value: Value| match me.0.send(T::from_lua(value, lua)?) {
Ok(()) => true.into_lua_multi(lua), Ok(()) => true.into_lua_multi(lua),
Err(e) => (false, Error::custom(e.to_string())).into_lua_multi(lua), Err(e) => (false, Error::custom(e.to_string())).into_lua_multi(lua),
}); });
} }
} }
impl UserData for MpscUnboundedRx { impl<T: IntoLua + 'static> UserData for MpscUnboundedRx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_async_method_mut("recv", |lua, mut me, ()| async move { methods.add_async_method_mut("recv", |lua, mut me, ()| async move {
match me.0.recv().await { match me.0.recv().await {
@ -50,16 +53,17 @@ impl UserData for MpscUnboundedRx {
} }
} }
pub struct OneshotTx(pub Option<tokio::sync::oneshot::Sender<Value>>); #[derive(FromLuaOwned)]
pub struct OneshotRx(pub Option<tokio::sync::oneshot::Receiver<Value>>); pub struct OneshotTx<T: FromLua + 'static>(pub Option<tokio::sync::oneshot::Sender<T>>);
pub struct OneshotRx<T: IntoLua + 'static>(pub Option<tokio::sync::oneshot::Receiver<T>>);
impl UserData for OneshotTx { impl<T: FromLua> UserData for OneshotTx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut("send", |lua, me, value: Value| { methods.add_method_mut("send", |lua, me, value: Value| {
let Some(tx) = me.0.take() else { let Some(tx) = me.0.take() else {
return Err("Oneshot sender already used".into_lua_err()); return Err("Oneshot sender already used".into_lua_err());
}; };
match tx.send(value) { match tx.send(T::from_lua(value, lua)?) {
Ok(()) => true.into_lua_multi(lua), Ok(()) => true.into_lua_multi(lua),
Err(_) => (false, Error::custom("Oneshot receiver closed")).into_lua_multi(lua), Err(_) => (false, Error::custom("Oneshot receiver closed")).into_lua_multi(lua),
} }
@ -67,7 +71,7 @@ impl UserData for OneshotTx {
} }
} }
impl UserData for OneshotRx { impl<T: IntoLua + 'static> UserData for OneshotRx<T> {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) { fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_async_method_mut("recv", |lua, mut me, ()| async move { methods.add_async_method_mut("recv", |lua, mut me, ()| async move {
let Some(rx) = me.0.take() else { let Some(rx) = me.0.take() else {

View file

@ -4,6 +4,10 @@ use yazi_codegen::FromLuaOwned;
#[derive(Clone, FromLuaOwned)] #[derive(Clone, FromLuaOwned)]
pub struct ChordCow(pub yazi_config::keymap::ChordCow); pub struct ChordCow(pub yazi_config::keymap::ChordCow);
impl From<yazi_config::keymap::ChordCow> for ChordCow {
fn from(value: yazi_config::keymap::ChordCow) -> Self { Self(value) }
}
impl From<ChordCow> for yazi_config::keymap::ChordCow { impl From<ChordCow> for yazi_config::keymap::ChordCow {
fn from(value: ChordCow) -> Self { value.0 } fn from(value: ChordCow) -> Self { value.0 }
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-boot" name = "yazi-boot"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,13 +12,13 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
# External dependencies # External dependencies
clap = { workspace = true } clap = { workspace = true }
@ -27,7 +27,7 @@ hashbrown = { workspace = true }
regex = { workspace = true } regex = { workspace = true }
[build-dependencies] [build-dependencies]
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
# External dependencies # External dependencies
clap = { workspace = true } clap = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-build" name = "yazi-build"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -18,7 +18,7 @@ panic = "abort"
strip = true strip = true
[build-dependencies] [build-dependencies]
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
[[bin]] [[bin]]
name = "yazi-build" name = "yazi-build"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-cli" name = "yazi-cli"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -22,12 +22,12 @@ inherits = "release"
panic = "unwind" panic = "unwind"
[dependencies] [dependencies]
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-shim = { path = "../yazi-shim", version = "26.1.22" } yazi-shim = { path = "../yazi-shim", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }
@ -40,7 +40,7 @@ toml = { workspace = true }
twox-hash = { workspace = true } twox-hash = { workspace = true }
[build-dependencies] [build-dependencies]
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
# External build dependencies # External build dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-codegen" name = "yazi-codegen"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-config" name = "yazi-config"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,11 +12,11 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-codegen = { path = "../yazi-codegen", version = "26.1.22" } yazi-codegen = { path = "../yazi-codegen", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-core" name = "yazi-core"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,20 +12,21 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-plugin = { path = "../yazi-plugin", version = "26.2.2" }
yazi-scheduler = { path = "../yazi-scheduler", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-scheduler = { path = "../yazi-scheduler", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-watcher = { path = "../yazi-watcher", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,8 +1,10 @@
use tokio::sync::mpsc;
use yazi_config::keymap::{ChordCow, Key}; use yazi_config::keymap::{ChordCow, Key};
use yazi_macro::{emit, render_and}; use yazi_macro::{emit, render_and};
#[derive(Default)] #[derive(Default)]
pub struct Which { pub struct Which {
pub tx: Option<mpsc::UnboundedSender<Option<yazi_binding::ChordCow>>>,
pub times: usize, pub times: usize,
pub cands: Vec<ChordCow>, pub cands: Vec<ChordCow>,
@ -17,23 +19,30 @@ impl Which {
self.times += 1; self.times += 1;
if self.cands.is_empty() { if self.cands.is_empty() {
self.reset(); self.dismiss(None);
} else if self.cands.len() == 1 { } else if self.cands.len() == 1 {
emit!(Seq(self.cands.remove(0).into_seq())); let chord = self.cands.remove(0);
self.reset(); self.dismiss(Some(chord));
} else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) { } else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) {
emit!(Seq(self.cands.remove(i).into_seq())); let chord = self.cands.remove(i);
self.reset(); self.dismiss(Some(chord));
} }
render_and!(true) render_and!(true)
} }
fn reset(&mut self) { pub fn dismiss(&mut self, chord: Option<ChordCow>) {
self.times = 0; self.times = 0;
self.cands.clear(); self.cands.clear();
self.active = false; self.active = false;
self.silent = false; self.silent = false;
if let Some(tx) = self.tx.take() {
_ = tx.send(chord.clone().map(Into::into));
}
if let Some(chord) = chord {
emit!(Seq(chord.into_seq()));
}
} }
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-dds" name = "yazi-dds"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -16,13 +16,13 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -147,8 +147,8 @@ pub enum Spark<'a> {
TasksUpdateSucceed(yazi_parser::tasks::UpdateSucceedOpt), TasksUpdateSucceed(yazi_parser::tasks::UpdateSucceedOpt),
// Which // Which
WhichCallback(yazi_parser::which::CallbackOpt),
WhichActivate(yazi_parser::which::ActivateOpt), WhichActivate(yazi_parser::which::ActivateOpt),
WhichDismiss(yazi_parser::VoidOpt),
} }
impl<'a> Spark<'a> { impl<'a> Spark<'a> {
@ -318,8 +318,8 @@ impl<'a> IntoLua for Spark<'a> {
Self::TasksUpdateSucceed(b) => b.into_lua(lua), Self::TasksUpdateSucceed(b) => b.into_lua(lua),
// Which // Which
Self::WhichCallback(b) => b.into_lua(lua),
Self::WhichActivate(b) => b.into_lua(lua), Self::WhichActivate(b) => b.into_lua(lua),
Self::WhichDismiss(b) => b.into_lua(lua),
} }
} }
} }
@ -343,7 +343,8 @@ try_from_spark!(
mgr:search_stop, mgr:search_stop,
mgr:suspend, mgr:suspend,
mgr:unyank, mgr:unyank,
mgr:watch mgr:watch,
which:dismiss
); );
// App // App
@ -415,7 +416,6 @@ try_from_spark!(yazi_parser::spot::CopyOpt, spot:copy);
try_from_spark!(yazi_parser::tasks::ProcessOpenOpt, tasks:process_open); try_from_spark!(yazi_parser::tasks::ProcessOpenOpt, tasks:process_open);
try_from_spark!(yazi_parser::tasks::UpdateSucceedOpt, tasks:update_succeed); try_from_spark!(yazi_parser::tasks::UpdateSucceedOpt, tasks:update_succeed);
try_from_spark!(yazi_parser::which::ActivateOpt, which:activate); try_from_spark!(yazi_parser::which::ActivateOpt, which:activate);
try_from_spark!(yazi_parser::which::CallbackOpt, which:callback);
try_from_spark!(yazi_widgets::input::parser::BackspaceOpt, input:backspace); try_from_spark!(yazi_widgets::input::parser::BackspaceOpt, input:backspace);
try_from_spark!(yazi_widgets::input::parser::BackwardOpt, input:backward); try_from_spark!(yazi_widgets::input::parser::BackwardOpt, input:backward);
try_from_spark!(yazi_widgets::input::parser::CompleteOpt, input:complete); try_from_spark!(yazi_widgets::input::parser::CompleteOpt, input:complete);

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-emulator" name = "yazi-emulator"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,9 +12,9 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-ffi" name = "yazi-ffi"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,7 +12,7 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-fm" name = "yazi-fm"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -26,25 +26,25 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-actor = { path = "../yazi-actor", version = "26.1.22" } yazi-actor = { path = "../yazi-actor", version = "26.2.2" }
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-core = { path = "../yazi-core", version = "26.1.22" } yazi-core = { path = "../yazi-core", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" } yazi-plugin = { path = "../yazi-plugin", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-term = { path = "../yazi-term", version = "26.1.22" } yazi-term = { path = "../yazi-term", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" } yazi-watcher = { path = "../yazi-watcher", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -352,7 +352,7 @@ impl<'a> Executor<'a> {
} }
on!(activate); on!(activate);
on!(callback); on!(dismiss);
succ!(); succ!();
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-fs" name = "yazi-fs"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,10 +12,10 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-ffi = { path = "../yazi-ffi", version = "26.1.22" } yazi-ffi = { path = "../yazi-ffi", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-shim = { path = "../yazi-shim", version = "26.1.22" } yazi-shim = { path = "../yazi-shim", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-macro" name = "yazi-macro"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-packing" name = "yazi-packing"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-parser" name = "yazi-parser"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -16,14 +16,14 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,9 +1,11 @@
use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value}; use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value};
use tokio::sync::mpsc;
use yazi_config::{KEYMAP, keymap::{ChordCow, Key}}; use yazi_config::{KEYMAP, keymap::{ChordCow, Key}};
use yazi_shared::{Layer, event::CmdCow}; use yazi_shared::{Layer, event::CmdCow};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ActivateOpt { pub struct ActivateOpt {
pub tx: Option<mpsc::UnboundedSender<Option<yazi_binding::ChordCow>>>,
pub cands: Vec<ChordCow>, pub cands: Vec<ChordCow>,
pub silent: bool, pub silent: bool,
pub times: usize, pub times: usize,
@ -18,6 +20,7 @@ impl TryFrom<CmdCow> for ActivateOpt {
} }
Ok(Self { Ok(Self {
tx: c.take_any2("tx").transpose()?,
cands: c.take_any_iter::<yazi_binding::ChordCow>().map(Into::into).collect(), cands: c.take_any_iter::<yazi_binding::ChordCow>().map(Into::into).collect(),
silent: c.bool("silent"), silent: c.bool("silent"),
times: c.get("times").unwrap_or(0), times: c.get("times").unwrap_or(0),
@ -28,6 +31,7 @@ impl TryFrom<CmdCow> for ActivateOpt {
impl From<(Layer, Key)> for ActivateOpt { impl From<(Layer, Key)> for ActivateOpt {
fn from((layer, key): (Layer, Key)) -> Self { fn from((layer, key): (Layer, Key)) -> Self {
Self { Self {
tx: None,
cands: KEYMAP cands: KEYMAP
.get(layer) .get(layer)
.iter() .iter()
@ -47,6 +51,7 @@ impl FromLua for ActivateOpt {
}; };
Ok(Self { Ok(Self {
tx: t.raw_get::<yazi_binding::MpscUnboundedTx<_>>("tx").ok().map(|t| t.0),
cands: t cands: t
.raw_get::<Table>("cands")? .raw_get::<Table>("cands")?
.sequence_values::<yazi_binding::ChordCow>() .sequence_values::<yazi_binding::ChordCow>()
@ -63,6 +68,7 @@ impl IntoLua for ActivateOpt {
fn into_lua(self, lua: &Lua) -> mlua::Result<Value> { fn into_lua(self, lua: &Lua) -> mlua::Result<Value> {
lua lua
.create_table_from([ .create_table_from([
("tx", self.tx.map(yazi_binding::MpscUnboundedTx).into_lua(lua)?),
("cands", lua.create_sequence_from(self.cands.into_iter().map(yazi_binding::ChordCow))?.into_lua(lua)?), ("cands", lua.create_sequence_from(self.cands.into_iter().map(yazi_binding::ChordCow))?.into_lua(lua)?),
("times", self.times.into_lua(lua)?), ("times", self.times.into_lua(lua)?),
("silent", self.silent.into_lua(lua)?), ("silent", self.silent.into_lua(lua)?),

View file

@ -1,34 +0,0 @@
use anyhow::bail;
use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
use tokio::sync::mpsc;
use yazi_shared::event::CmdCow;
#[derive(Debug)]
pub struct CallbackOpt {
pub tx: mpsc::UnboundedSender<usize>,
pub idx: usize,
}
impl TryFrom<CmdCow> for CallbackOpt {
type Error = anyhow::Error;
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
let Some(tx) = c.take_any("tx") else {
bail!("Invalid 'tx' in CallbackOpt");
};
let Ok(idx) = c.first() else {
bail!("Invalid 'idx' in CallbackOpt");
};
Ok(Self { tx, idx })
}
}
impl FromLua for CallbackOpt {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
}
impl IntoLua for CallbackOpt {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
}

View file

@ -1 +1 @@
yazi_macro::mod_flat!(activate callback); yazi_macro::mod_flat!(activate);

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-plugin" name = "yazi-plugin"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -16,20 +16,20 @@ default = [ "vendored-lua" ]
vendored-lua = [ "mlua/vendored" ] vendored-lua = [ "mlua/vendored" ]
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-boot = { path = "../yazi-boot", version = "26.1.22" } yazi-boot = { path = "../yazi-boot", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-shim = { path = "../yazi-shim", version = "26.1.22" } yazi-shim = { path = "../yazi-shim", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -13,9 +13,8 @@ pub async fn entry(opt: PluginOpt) -> mlua::Result<()> {
let lua = slim_lua(&opt.id)?; let lua = slim_lua(&opt.id)?;
let job = lua.create_table_from([("args", Sendable::args_to_table(&lua, opt.args)?)])?; let job = lua.create_table_from([("args", Sendable::args_to_table(&lua, opt.args)?)])?;
Handle::current().block_on(async { Handle::current()
LOADER.load_once(&lua, &opt.id).await?.call_async_method("entry", job).await .block_on(async { LOADER.load(&lua, &opt.id).await?.call_async_method("entry", job).await })
})
}) })
.await .await
.into_lua_err()? .into_lua_err()?

View file

@ -23,9 +23,8 @@ pub async fn fetch(
("files", lua.create_sequence_from(files.into_iter().map(File::new))?.into_lua(&lua)?), ("files", lua.create_sequence_from(files.into_iter().map(File::new))?.into_lua(&lua)?),
])?; ])?;
Handle::current().block_on(async { Handle::current()
LOADER.load_once(&lua, &cmd.name).await?.call_async_method("fetch", job).await .block_on(async { LOADER.load(&lua, &cmd.name).await?.call_async_method("fetch", job).await })
})
}) })
.await .await
.into_lua_err()? .into_lua_err()?

View file

@ -89,7 +89,7 @@ fn peek_async(
}, },
)?; )?;
let plugin = LOADER.load_once(&lua, &cmd.name).await?; let plugin = LOADER.load(&lua, &cmd.name).await?;
let job = lua.create_table_from([ let job = lua.create_table_from([
("area", Rect::from(LAYOUT.get().preview).into_lua(&lua)?), ("area", Rect::from(LAYOUT.get().preview).into_lua(&lua)?),
("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?), ("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?),

View file

@ -31,7 +31,7 @@ pub async fn preload(
}, },
)?; )?;
let plugin = LOADER.load_once(&lua, &cmd.name).await?; let plugin = LOADER.load(&lua, &cmd.name).await?;
let job = lua.create_table_from([ let job = lua.create_table_from([
("area", Rect::from(LAYOUT.get().preview).into_lua(&lua)?), ("area", Rect::from(LAYOUT.get().preview).into_lua(&lua)?),
("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?), ("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?),

View file

@ -36,7 +36,7 @@ pub fn spot(
}, },
)?; )?;
let plugin = LOADER.load_once(&lua, &cmd.name).await?; let plugin = LOADER.load(&lua, &cmd.name).await?;
let job = lua.create_table_from([ let job = lua.create_table_from([
("id", Id(IDS.next()).into_lua(&lua)?), ("id", Id(IDS.next()).into_lua(&lua)?),
("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?), ("args", Sendable::args_to_table_ref(&lua, &cmd.args)?.into_lua(&lua)?),

View file

@ -105,14 +105,14 @@ impl Loader {
return Ok(t); return Ok(t);
} }
let t = self.load_once(lua, id).await?; let t = self.load_new(lua, id).await?;
t.raw_set("_id", lua.create_string(id)?)?; t.raw_set("_id", lua.create_string(id)?)?;
loaded.raw_set(id, t.clone())?; loaded.raw_set(id, t.clone())?;
Ok(t) Ok(t)
} }
pub async fn load_once(&self, lua: &Lua, id: &str) -> mlua::Result<Table> { async fn load_new(&self, lua: &Lua, id: &str) -> mlua::Result<Table> {
let (id, ..) = Self::normalize_id(id)?; let (id, ..) = Self::normalize_id(id)?;
let mut mode = ChunkMode::Text; let mut mode = ChunkMode::Text;
@ -135,12 +135,7 @@ impl Loader {
f.call_async(()).await f.call_async(()).await
} }
pub fn try_load(&self, lua: &Lua, id: &str) -> mlua::Result<Table> { pub fn load_chunk(&self, lua: &Lua, id: &str, chunk: &Chunk) -> mlua::Result<Table> {
let (id, ..) = Self::normalize_id(id)?;
lua.globals().raw_get::<Table>("package")?.raw_get::<Table>("loaded")?.raw_get(id)
}
pub fn load_with(&self, lua: &Lua, id: &str, chunk: &Chunk) -> mlua::Result<Table> {
let (id, ..) = Self::normalize_id(id)?; let (id, ..) = Self::normalize_id(id)?;
let loaded: Table = lua.globals().raw_get::<Table>("package")?.raw_get("loaded")?; let loaded: Table = lua.globals().raw_get::<Table>("package")?.raw_get("loaded")?;
@ -155,6 +150,11 @@ impl Loader {
Ok(t) Ok(t)
} }
pub fn try_load(&self, lua: &Lua, id: &str) -> mlua::Result<Table> {
let (id, ..) = Self::normalize_id(id)?;
lua.globals().raw_get::<Table>("package")?.raw_get::<Table>("loaded")?.raw_get(id)
}
pub fn compatible_or_error(id: &str, chunk: &Chunk) -> Result<()> { pub fn compatible_or_error(id: &str, chunk: &Chunk) -> Result<()> {
if chunk.compatible() { if chunk.compatible() {
return Ok(()); return Ok(());

View file

@ -1,14 +1,13 @@
use std::{str::FromStr, time::Duration}; use std::{str::FromStr, time::Duration};
use mlua::{ExternalError, ExternalResult, Function, IntoLuaMulti, Lua, Table, Value}; use mlua::{ExternalError, ExternalResult, Function, IntoLuaMulti, Lua, Table, Value};
use tokio::sync::mpsc;
use tokio_stream::wrappers::UnboundedReceiverStream; use tokio_stream::wrappers::UnboundedReceiverStream;
use yazi_binding::{InputRx, elements::{Line, Pos, Text}, runtime}; use yazi_binding::{InputRx, elements::{Line, Pos, Text}, runtime};
use yazi_config::{keymap::{Chord, ChordCow, Key}, popup::{ConfirmCfg, InputCfg}}; use yazi_config::{keymap::{Chord, ChordCow, Key}, popup::{ConfirmCfg, InputCfg}};
use yazi_macro::relay; use yazi_macro::relay;
use yazi_parser::{notify::PushOpt, which::ActivateOpt}; use yazi_parser::notify::PushOpt;
use yazi_proxy::{ConfirmProxy, InputProxy, NotifyProxy, WhichProxy}; use yazi_proxy::{ConfirmProxy, InputProxy, NotifyProxy, WhichProxy};
use yazi_shared::Debounce; use yazi_shared::{Debounce, Layer};
use super::Utils; use super::Utils;
@ -19,7 +18,6 @@ impl Utils {
return Err("Cannot call `ya.which()` while main thread is blocked".into_lua_err()); return Err("Cannot call `ya.which()` while main thread is blocked".into_lua_err());
} }
let (tx, mut rx) = mpsc::unbounded_channel::<usize>();
let cands: Vec<_> = t let cands: Vec<_> = t
.raw_get::<Table>("cands")? .raw_get::<Table>("cands")?
.sequence_values::<Table>() .sequence_values::<Table>()
@ -28,17 +26,21 @@ impl Utils {
let cand = cand?; let cand = cand?;
Ok(ChordCow::Owned(Chord { Ok(ChordCow::Owned(Chord {
on: Self::parse_keys(cand.raw_get("on")?)?, on: Self::parse_keys(cand.raw_get("on")?)?,
run: vec![relay!(which:callback, [i]).with_any("tx", tx.clone())], run: vec![relay!(which:callback, [i + 1])],
desc: cand.raw_get("desc").ok(), desc: cand.raw_get("desc").ok(),
r#for: None, r#for: None,
})) }))
}) })
.collect::<mlua::Result<_>>()?; .collect::<mlua::Result<_>>()?;
drop(tx); let idx: Option<usize> = WhichProxy::activate(cands, t.raw_get("silent")?)
WhichProxy::activate(ActivateOpt { cands, times: 0, silent: t.raw_get("silent")? }); .await
.iter()
.flat_map(|chord| &chord.run)
.find(|cmd| cmd.layer == Layer::Which && cmd.name == "callback")
.and_then(|cmd| cmd.first().ok());
Ok(rx.recv().await.map(|idx| idx + 1)) Ok(idx)
}) })
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-proxy" name = "yazi-proxy"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,11 +12,12 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-widgets = { path = "../yazi-widgets", version = "26.2.2" }
# External dependencies # External dependencies
tokio = { workspace = true } tokio = { workspace = true }

View file

@ -1,10 +1,19 @@
use tokio::sync::mpsc;
use yazi_config::keymap::ChordCow;
use yazi_macro::{emit, relay}; use yazi_macro::{emit, relay};
use yazi_parser::which::ActivateOpt; use yazi_parser::which::ActivateOpt;
pub struct WhichProxy; pub struct WhichProxy;
impl WhichProxy { impl WhichProxy {
pub fn activate(opt: ActivateOpt) { pub async fn activate(cands: Vec<ChordCow>, silent: bool) -> Option<ChordCow> {
emit!(Call(relay!(which:activate).with_any("opt", opt))); let (tx, mut rx) = mpsc::unbounded_channel();
emit!(Call(relay!(which:activate).with_any("opt", ActivateOpt {
tx: Some(tx),
cands,
silent,
times: 0,
})));
Some(rx.recv().await??.0)
} }
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-scheduler" name = "yazi-scheduler"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,16 +12,16 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-binding = { path = "../yazi-binding", version = "26.1.22" } yazi-binding = { path = "../yazi-binding", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-parser = { path = "../yazi-parser", version = "26.1.22" } yazi-parser = { path = "../yazi-parser", version = "26.2.2" }
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" } yazi-plugin = { path = "../yazi-plugin", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-sftp" name = "yazi-sftp"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "AspectUnk", "sxyazi <sxyazi@gmail.com>" ] authors = [ "AspectUnk", "sxyazi <sxyazi@gmail.com>" ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-shared" name = "yazi-shared"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -13,7 +13,7 @@ rust-version = "1.92.0"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-shim" name = "yazi-shim"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,7 +12,7 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
# External dependencies # External dependencies
crossterm = { workspace = true } crossterm = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-term" name = "yazi-term"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,12 +12,12 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" } yazi-emulator = { path = "../yazi-emulator", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-shim = { path = "../yazi-shim", version = "26.1.22" } yazi-shim = { path = "../yazi-shim", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-tty" name = "yazi-tty"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,8 +12,8 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
# External dependencies # External dependencies
parking_lot = { workspace = true } parking_lot = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-vfs" name = "yazi-vfs"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,11 +12,11 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-sftp = { path = "../yazi-sftp", version = "26.1.22" } yazi-sftp = { path = "../yazi-sftp", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-watcher" name = "yazi-watcher"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,13 +12,13 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-dds = { path = "../yazi-dds", version = "26.1.22" } yazi-dds = { path = "../yazi-dds", version = "26.2.2" }
yazi-fs = { path = "../yazi-fs", version = "26.1.22" } yazi-fs = { path = "../yazi-fs", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" } yazi-proxy = { path = "../yazi-proxy", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" } yazi-vfs = { path = "../yazi-vfs", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yazi-widgets" name = "yazi-widgets"
version = "26.1.22" version = "26.2.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
@ -12,11 +12,11 @@ repository = "https://github.com/sxyazi/yazi"
workspace = true workspace = true
[dependencies] [dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" } yazi-adapter = { path = "../yazi-adapter", version = "26.2.2" }
yazi-config = { path = "../yazi-config", version = "26.1.22" } yazi-config = { path = "../yazi-config", version = "26.2.2" }
yazi-macro = { path = "../yazi-macro", version = "26.1.22" } yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
yazi-shared = { path = "../yazi-shared", version = "26.1.22" } yazi-shared = { path = "../yazi-shared", version = "26.2.2" }
yazi-tty = { path = "../yazi-tty", version = "26.1.22" } yazi-tty = { path = "../yazi-tty", version = "26.2.2" }
# External dependencies # External dependencies
anyhow = { workspace = true } anyhow = { workspace = true }