mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
refactor: new yazi-emulator crate (#3624)
This commit is contained in:
parent
e0911f2507
commit
24c60419bb
41 changed files with 178 additions and 128 deletions
76
Cargo.lock
generated
76
Cargo.lock
generated
|
|
@ -1240,9 +1240,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.11.0-rc.8"
|
||||
version = "0.11.0-rc.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fc1408b7a9f59a7b933faff3e9e7fc15a05a524effd3b3d1601156944c8077f"
|
||||
checksum = "bff8de092798697546237a3a701e4174fe021579faec9b854379af9bf1e31962"
|
||||
dependencies = [
|
||||
"block-buffer 0.11.0",
|
||||
"const-oid 0.10.2",
|
||||
|
|
@ -2064,7 +2064,7 @@ checksum = "fe44f2bbd99fcb302e246e2d6bcf51aeda346d02a365f80296a07a8c711b6da6"
|
|||
dependencies = [
|
||||
"argon2",
|
||||
"bcrypt-pbkdf",
|
||||
"digest 0.11.0-rc.8",
|
||||
"digest 0.11.0-rc.9",
|
||||
"ecdsa",
|
||||
"ed25519-dalek",
|
||||
"hex",
|
||||
|
|
@ -2585,9 +2585,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "notify-types"
|
||||
version = "2.0.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d"
|
||||
checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
|
|
@ -3130,9 +3133,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.11.0-rc.9"
|
||||
version = "0.11.0-rc.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80f8fa6196ede5a9f9ee95b44ca134bddc9b70e8913f9297bd58c909f5889a09"
|
||||
checksum = "b226d2cc389763951db8869584fd800cbbe2962bf454e2edeb5172b31ee99774"
|
||||
dependencies = [
|
||||
"der 0.8.0-rc.10",
|
||||
"spki 0.8.0-rc.4",
|
||||
|
|
@ -3688,9 +3691,9 @@ dependencies = [
|
|||
"const-oid 0.10.2",
|
||||
"crypto-bigint 0.7.0-rc.18",
|
||||
"crypto-primes",
|
||||
"digest 0.11.0-rc.8",
|
||||
"digest 0.11.0-rc.9",
|
||||
"pkcs1",
|
||||
"pkcs8 0.11.0-rc.9",
|
||||
"pkcs8 0.11.0-rc.10",
|
||||
"rand_core 0.10.0-rc-3",
|
||||
"sha2 0.11.0-rc.4",
|
||||
"signature 3.0.0-rc.6",
|
||||
|
|
@ -4053,7 +4056,7 @@ checksum = "9c777f0a122a53fddb0beb6e706771197000b8eb5c9f42b5b850f450ef48c788"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest 0.11.0-rc.8",
|
||||
"digest 0.11.0-rc.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4075,7 +4078,7 @@ checksum = "7535f94fa3339fe9e5e9be6260a909e62af97f6e14b32345ccf79b92b8b81233"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest 0.11.0-rc.8",
|
||||
"digest 0.11.0-rc.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4162,7 +4165,7 @@ version = "3.0.0-rc.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a96996ccff7dfa16f052bd995b4cecc72af22c35138738dc029f0ead6608d"
|
||||
dependencies = [
|
||||
"digest 0.11.0-rc.8",
|
||||
"digest 0.11.0-rc.9",
|
||||
"rand_core 0.10.0-rc-3",
|
||||
]
|
||||
|
||||
|
|
@ -4189,9 +4192,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
|||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||
checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
|
|
@ -4849,9 +4852,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.19.0"
|
||||
version = "1.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
|
||||
checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"getrandom 0.3.4",
|
||||
|
|
@ -5555,7 +5558,6 @@ dependencies = [
|
|||
"yazi-proxy",
|
||||
"yazi-scheduler",
|
||||
"yazi-shared",
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
"yazi-vfs",
|
||||
"yazi-watcher",
|
||||
|
|
@ -5575,14 +5577,13 @@ dependencies = [
|
|||
"palette",
|
||||
"quantette",
|
||||
"ratatui",
|
||||
"scopeguard",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"yazi-config",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
]
|
||||
|
||||
|
|
@ -5622,6 +5623,7 @@ dependencies = [
|
|||
"vergen-gitcl",
|
||||
"yazi-adapter",
|
||||
"yazi-config",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
|
|
@ -5632,7 +5634,6 @@ dependencies = [
|
|||
name = "yazi-build"
|
||||
version = "26.1.22"
|
||||
dependencies = [
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
]
|
||||
|
||||
|
|
@ -5689,7 +5690,6 @@ dependencies = [
|
|||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
]
|
||||
|
||||
|
|
@ -5711,6 +5711,7 @@ dependencies = [
|
|||
"yazi-adapter",
|
||||
"yazi-config",
|
||||
"yazi-dds",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-parser",
|
||||
|
|
@ -5748,6 +5749,20 @@ dependencies = [
|
|||
"yazi-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yazi-emulator"
|
||||
version = "26.1.22"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crossterm 0.29.0",
|
||||
"scopeguard",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-tty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yazi-ffi"
|
||||
version = "26.1.22"
|
||||
|
|
@ -5787,6 +5802,7 @@ dependencies = [
|
|||
"yazi-config",
|
||||
"yazi-core",
|
||||
"yazi-dds",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-parser",
|
||||
|
|
@ -5890,6 +5906,7 @@ dependencies = [
|
|||
"yazi-boot",
|
||||
"yazi-config",
|
||||
"yazi-dds",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-parser",
|
||||
|
|
@ -5911,7 +5928,6 @@ checksum = "33232d9116df6415ddfcdf72701b1b7439ce87f240a14723e8dd5d17e7ed5f98"
|
|||
name = "yazi-proxy"
|
||||
version = "26.1.22"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"tokio",
|
||||
"yazi-config",
|
||||
"yazi-macro",
|
||||
|
|
@ -5998,10 +6014,7 @@ version = "26.1.22"
|
|||
dependencies = [
|
||||
"crossterm 0.29.0",
|
||||
"libc",
|
||||
"parking_lot",
|
||||
"tracing",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6075,24 +6088,23 @@ dependencies = [
|
|||
"yazi-macro",
|
||||
"yazi-parser",
|
||||
"yazi-shared",
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.33"
|
||||
version = "0.8.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd"
|
||||
checksum = "71ddd76bcebeed25db614f82bf31a9f4222d3fbba300e6fb6c00afa26cbd4d9d"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.33"
|
||||
version = "0.8.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
|
||||
checksum = "d8187381b52e32220d50b255276aa16a084ec0a9017a0ca2152a1f55c539758d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -6121,9 +6133,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.16"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65"
|
||||
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
|
||||
|
||||
[[package]]
|
||||
name = "zune-core"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" }
|
|||
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" }
|
||||
yazi-scheduler = { path = "../yazi-scheduler", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" }
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ repository = "https://github.com/sxyazi/yazi"
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
ansi-to-tui = { workspace = true }
|
||||
|
|
@ -29,7 +29,6 @@ moxcms = "0.8.0"
|
|||
palette = { version = "0.7.6", default-features = false }
|
||||
quantette = { version = "0.5.1", default-features = false }
|
||||
ratatui = { workspace = true }
|
||||
scopeguard = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ use std::{env, fmt::Display, path::PathBuf};
|
|||
use anyhow::Result;
|
||||
use ratatui::layout::Rect;
|
||||
use tracing::warn;
|
||||
use yazi_emulator::{Emulator, TMUX};
|
||||
use yazi_shared::env_exists;
|
||||
|
||||
use crate::{Adapters, Emulator, SHOWN, TMUX, drivers};
|
||||
use crate::{Adapters, SHOWN, drivers};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Adapter {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
|
|||
|
||||
use yazi_shared::Either;
|
||||
|
||||
use crate::{Adapter, Brand, Emulator, Unknown};
|
||||
use crate::Adapter;
|
||||
|
||||
pub(super) struct Adapters(Vec<Adapter>);
|
||||
|
||||
|
|
@ -16,8 +16,8 @@ impl DerefMut for Adapters {
|
|||
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
|
||||
}
|
||||
|
||||
impl From<&Emulator> for Adapters {
|
||||
fn from(value: &Emulator) -> Self {
|
||||
impl From<&yazi_emulator::Emulator> for Adapters {
|
||||
fn from(value: &yazi_emulator::Emulator) -> Self {
|
||||
match value.kind {
|
||||
Either::Left(b) => b.into(),
|
||||
Either::Right(u) => u.into(),
|
||||
|
|
@ -25,9 +25,9 @@ impl From<&Emulator> for Adapters {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Brand> for Adapters {
|
||||
fn from(value: Brand) -> Self {
|
||||
use Brand as B;
|
||||
impl From<yazi_emulator::Brand> for Adapters {
|
||||
fn from(value: yazi_emulator::Brand) -> Self {
|
||||
use yazi_emulator::Brand as B;
|
||||
|
||||
use crate::Adapter as A;
|
||||
|
||||
|
|
@ -55,8 +55,8 @@ impl From<Brand> for Adapters {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Unknown> for Adapters {
|
||||
fn from(value: Unknown) -> Self {
|
||||
impl From<yazi_emulator::Unknown> for Adapters {
|
||||
fn from(value: yazi_emulator::Unknown) -> Self {
|
||||
use Adapter as A;
|
||||
|
||||
Self(match (value.kgp, value.sixel) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ use anyhow::{Result, anyhow, bail};
|
|||
use crossterm::{cursor::MoveTo, queue};
|
||||
use ratatui::layout::Rect;
|
||||
use tokio::process::Command;
|
||||
use yazi_emulator::Emulator;
|
||||
|
||||
use crate::{Adapter, Emulator};
|
||||
use crate::Adapter;
|
||||
|
||||
pub(crate) struct Chafa;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ use crossterm::{cursor::MoveTo, queue};
|
|||
use image::{DynamicImage, ExtendedColorType, ImageEncoder, codecs::{jpeg::JpegEncoder, png::PngEncoder}};
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_config::YAZI;
|
||||
use yazi_emulator::{CLOSE, Emulator, START};
|
||||
|
||||
use crate::{CLOSE, Emulator, Image, START, adapter::Adapter};
|
||||
use crate::{Image, adapter::Adapter};
|
||||
|
||||
pub(crate) struct Iip;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ use base64::{Engine, engine::general_purpose};
|
|||
use crossterm::{cursor::MoveTo, queue};
|
||||
use image::DynamicImage;
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
|
||||
use yazi_shared::SyncCell;
|
||||
|
||||
use crate::{CLOSE, ESCAPE, Emulator, START, adapter::Adapter, image::Image};
|
||||
use crate::{adapter::Adapter, image::Image};
|
||||
|
||||
static DIACRITICS: [char; 297] = [
|
||||
'\u{0305}',
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ use anyhow::Result;
|
|||
use base64::{Engine, engine::general_purpose};
|
||||
use image::DynamicImage;
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
|
||||
use yazi_tty::TTY;
|
||||
|
||||
use crate::{CLOSE, ESCAPE, Emulator, Image, START, adapter::Adapter};
|
||||
use crate::{Image, adapter::Adapter};
|
||||
|
||||
pub(crate) struct KgpOld;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ use image::{DynamicImage, GenericImageView, RgbImage};
|
|||
use palette::{Srgb, cast::ComponentsAs};
|
||||
use quantette::{PaletteSize, color_map::IndexedColorMap, wu::{BinnerU8x3, WuU8x3}};
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_emulator::{CLOSE, ESCAPE, Emulator, START};
|
||||
|
||||
use crate::{CLOSE, ESCAPE, Emulator, Image, START, adapter::Adapter};
|
||||
use crate::{Image, adapter::Adapter};
|
||||
|
||||
pub(crate) struct Sixel;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ use ratatui::layout::Rect;
|
|||
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
|
||||
use tracing::{debug, warn};
|
||||
use yazi_config::YAZI;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_shared::{LOG_LEVEL, RoCell, env_exists};
|
||||
|
||||
use crate::{Adapter, Dimension};
|
||||
use crate::Adapter;
|
||||
|
||||
type Cmd = Option<(PathBuf, Rect)>;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ use anyhow::Result;
|
|||
use image::{DynamicImage, ImageDecoder, ImageError, ImageReader, Limits, codecs::{jpeg::JpegEncoder, png::PngEncoder}, imageops::FilterType, metadata::Orientation};
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_config::YAZI;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_fs::provider::{Provider, local::Local};
|
||||
|
||||
use crate::{Dimension, Icc};
|
||||
use crate::Icc;
|
||||
|
||||
pub struct Image;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
yazi_macro::mod_pub!(drivers);
|
||||
|
||||
yazi_macro::mod_flat!(adapter adapters brand dimension emulator icc image info mux unknown);
|
||||
yazi_macro::mod_flat!(adapter adapters icc image info);
|
||||
|
||||
use yazi_shared::{RoCell, SyncCell, in_wsl};
|
||||
use yazi_emulator::{Brand, CLOSE, EMULATOR, ESCAPE, Emulator, Mux, START, TMUX};
|
||||
use yazi_shared::{SyncCell, in_wsl};
|
||||
|
||||
pub static EMULATOR: RoCell<Emulator> = RoCell::new();
|
||||
pub static ADAPTOR: SyncCell<Adapter> = SyncCell::new(Adapter::Chafa);
|
||||
|
||||
// Image state
|
||||
|
|
@ -13,12 +13,6 @@ static SHOWN: SyncCell<Option<ratatui::layout::Rect>> = SyncCell::new(None);
|
|||
// WSL support
|
||||
pub static WSL: SyncCell<bool> = SyncCell::new(false);
|
||||
|
||||
// Tmux support
|
||||
pub static TMUX: SyncCell<bool> = SyncCell::new(false);
|
||||
static ESCAPE: SyncCell<&'static str> = SyncCell::new("\x1b");
|
||||
static START: SyncCell<&'static str> = SyncCell::new("\x1b");
|
||||
static CLOSE: SyncCell<&'static str> = SyncCell::new("");
|
||||
|
||||
pub fn init() -> anyhow::Result<()> {
|
||||
// WSL support
|
||||
WSL.set(in_wsl());
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ repository = "https://github.com/sxyazi/yazi"
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
clap = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::{env, ffi::OsStr, fmt::Write, path::Path};
|
||||
|
||||
use regex::Regex;
|
||||
use yazi_adapter::Mux;
|
||||
use yazi_config::{THEME, YAZI};
|
||||
use yazi_emulator::Mux;
|
||||
use yazi_fs::Xdg;
|
||||
use yazi_shared::timestamp_us;
|
||||
|
||||
|
|
@ -33,12 +33,12 @@ impl Actions {
|
|||
writeln!(s, " TERM : {:?}", env::var_os("TERM"))?;
|
||||
writeln!(s, " TERM_PROGRAM : {:?}", env::var_os("TERM_PROGRAM"))?;
|
||||
writeln!(s, " TERM_PROGRAM_VERSION: {:?}", env::var_os("TERM_PROGRAM_VERSION"))?;
|
||||
writeln!(s, " Brand.from_env : {:?}", yazi_adapter::Brand::from_env())?;
|
||||
writeln!(s, " Emulator.detect : {:?}", &*yazi_adapter::EMULATOR)?;
|
||||
writeln!(s, " Brand.from_env : {:?}", yazi_emulator::Brand::from_env())?;
|
||||
writeln!(s, " Emulator.detect : {:?}", &*yazi_emulator::EMULATOR)?;
|
||||
|
||||
writeln!(s, "\nAdapter")?;
|
||||
writeln!(s, " Adapter.matches : {:?}", yazi_adapter::ADAPTOR)?;
|
||||
writeln!(s, " Dimension.available: {:?}", yazi_adapter::Dimension::available())?;
|
||||
writeln!(s, " Dimension.available: {:?}", yazi_emulator::Dimension::available())?;
|
||||
|
||||
writeln!(s, "\nDesktop")?;
|
||||
writeln!(s, " XDG_SESSION_TYPE : {:?}", env::var_os("XDG_SESSION_TYPE"))?;
|
||||
|
|
@ -83,7 +83,7 @@ impl Actions {
|
|||
)?;
|
||||
|
||||
writeln!(s, "\nMultiplexers")?;
|
||||
writeln!(s, " TMUX : {}", yazi_adapter::TMUX)?;
|
||||
writeln!(s, " TMUX : {}", yazi_emulator::TMUX)?;
|
||||
writeln!(s, " tmux version : {}", Self::process_output("tmux", "-V"))?;
|
||||
writeln!(s, " tmux build flags : enable-sixel={}", Mux::tmux_sixel_flag())?;
|
||||
writeln!(s, " ZELLIJ_SESSION_NAME: {:?}", env::var_os("ZELLIJ_SESSION_NAME"))?;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ panic = "abort"
|
|||
strip = true
|
||||
|
||||
[build-dependencies]
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ yazi-codegen = { path = "../yazi-codegen", version = "26.1.22" }
|
|||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ workspace = true
|
|||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.1.22" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use anyhow::Result;
|
||||
use crossterm::{cursor::SetCursorStyle, event::KeyCode};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_config::{KEYMAP, YAZI, keymap::{Chord, Key}};
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_macro::{act, render, render_and};
|
||||
use yazi_shared::Layer;
|
||||
use yazi_widgets::Scrollable;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::iter;
|
||||
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_config::popup::{Origin, Position};
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_fs::Splatable;
|
||||
use yazi_shared::url::{AsUrl, Url, UrlBuf};
|
||||
use yazi_watcher::Watcher;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use anyhow::Result;
|
||||
use ratatui::layout::Rect;
|
||||
use tokio::task::JoinHandle;
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_config::{LAYOUT, popup::{Origin, Position}};
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_fs::File;
|
||||
use yazi_shared::{Id, Ids, url::UrlBuf};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration};
|
|||
|
||||
use parking_lot::Mutex;
|
||||
use tokio::{task::JoinHandle, time::sleep};
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_parser::app::TaskSummary;
|
||||
use yazi_proxy::AppProxy;
|
||||
use yazi_scheduler::{Ongoing, Scheduler, TaskSnap};
|
||||
|
|
|
|||
27
yazi-emulator/Cargo.toml
Normal file
27
yazi-emulator/Cargo.toml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[package]
|
||||
name = "yazi-emulator"
|
||||
version = "26.1.22"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||
description = "Yazi terminal emulator database"
|
||||
homepage = "https://yazi-rs.github.io"
|
||||
repository = "https://github.com/sxyazi/yazi"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
crossterm = { workspace = true }
|
||||
scopeguard = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
crossterm = { workspace = true, features = [ "use-dev-tty", "libc" ] }
|
||||
5
yazi-emulator/README.md
Normal file
5
yazi-emulator/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# yazi-emulator
|
||||
|
||||
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
|
||||
|
||||
[source]: https://github.com/sxyazi/yazi
|
||||
|
|
@ -5,11 +5,13 @@ use crossterm::{cursor::{RestorePosition, SavePosition}, execute, style::Print,
|
|||
use scopeguard::defer;
|
||||
use tokio::time::sleep;
|
||||
use tracing::{debug, error, warn};
|
||||
use yazi_shared::Either;
|
||||
use yazi_shared::{Either, RoCell};
|
||||
use yazi_tty::{Handle, TTY};
|
||||
|
||||
use crate::{Brand, Dimension, Mux, TMUX, Unknown};
|
||||
|
||||
pub static EMULATOR: RoCell<Emulator> = RoCell::new();
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Emulator {
|
||||
pub kind: Either<Brand, Unknown>,
|
||||
1
yazi-emulator/src/lib.rs
Normal file
1
yazi-emulator/src/lib.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
yazi_macro::mod_flat!(brand dimension emulator mux unknown);
|
||||
|
|
@ -3,9 +3,15 @@ use std::borrow::Cow;
|
|||
use anyhow::Result;
|
||||
use tracing::error;
|
||||
use yazi_macro::time;
|
||||
use yazi_shared::SyncCell;
|
||||
use yazi_tty::TTY;
|
||||
|
||||
use crate::{CLOSE, ESCAPE, Emulator, START, TMUX};
|
||||
use crate::Emulator;
|
||||
|
||||
pub static TMUX: SyncCell<bool> = SyncCell::new(false);
|
||||
pub static ESCAPE: SyncCell<&'static str> = SyncCell::new("\x1b");
|
||||
pub static START: SyncCell<&'static str> = SyncCell::new("\x1b");
|
||||
pub static CLOSE: SyncCell<&'static str> = SyncCell::new("");
|
||||
|
||||
pub struct Mux;
|
||||
|
||||
|
|
@ -26,24 +26,25 @@ default = [ "vendored-lua" ]
|
|||
vendored-lua = [ "mlua/vendored" ]
|
||||
|
||||
[dependencies]
|
||||
yazi-actor = { path = "../yazi-actor", version = "26.1.22" }
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-binding = { path = "../yazi-binding", version = "26.1.22" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-core = { path = "../yazi-core", version = "26.1.22" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" }
|
||||
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" }
|
||||
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" }
|
||||
yazi-actor = { path = "../yazi-actor", version = "26.1.22" }
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-binding = { path = "../yazi-binding", version = "26.1.22" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-core = { path = "../yazi-core", version = "26.1.22" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.1.22" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
yazi-plugin = { path = "../yazi-plugin", version = "26.1.22" }
|
||||
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-watcher = { path = "../yazi-watcher", version = "26.1.22" }
|
||||
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_macro::act;
|
||||
use yazi_parser::notify::TickOpt;
|
||||
use yazi_shared::data::Data;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::path::MAIN_SEPARATOR_STR;
|
||||
|
||||
use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, List, ListItem, Widget}};
|
||||
use yazi_adapter::Dimension;
|
||||
use yazi_config::{THEME, popup::{Offset, Position}};
|
||||
use yazi_core::Core;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_shared::strand::StrandLike;
|
||||
|
||||
pub(crate) struct Cmp<'a> {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use std::{io, ops::{Deref, DerefMut}, sync::atomic::{AtomicBool, Ordering}};
|
|||
use anyhow::Result;
|
||||
use crossterm::{event::{DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste, EnableFocusChange, EnableMouseCapture, KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags}, execute, queue, style::Print, terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle, disable_raw_mode, enable_raw_mode}};
|
||||
use ratatui::{CompletedFrame, Frame, Terminal, backend::CrosstermBackend, buffer::Buffer, layout::Rect};
|
||||
use yazi_adapter::{Emulator, Mux, TMUX};
|
||||
use yazi_config::{THEME, YAZI};
|
||||
use yazi_emulator::{Emulator, Mux, TMUX};
|
||||
use yazi_shared::SyncCell;
|
||||
use yazi_tty::{TTY, TtyWriter};
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ impl Term {
|
|||
|
||||
enable_raw_mode()?;
|
||||
static FIRST: SyncCell<bool> = SyncCell::new(false);
|
||||
if FIRST.replace(true) && yazi_adapter::TMUX.get() {
|
||||
yazi_adapter::Mux::tmux_passthrough();
|
||||
if FIRST.replace(true) && yazi_emulator::TMUX.get() {
|
||||
yazi_emulator::Mux::tmux_passthrough();
|
||||
}
|
||||
|
||||
execute!(
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ hashbrown = { workspace = true }
|
|||
mlua = { workspace = true }
|
||||
ordered-float = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_with = { workspace = true }
|
||||
serde_with = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct NotifyOpt {
|
|||
pub title: String,
|
||||
pub content: String,
|
||||
pub level: NotifyLevel,
|
||||
#[serde_as(as = "DurationSeconds<f64>")] // FIXME
|
||||
#[serde_as(as = "DurationSeconds<f64>")] // FIXME
|
||||
pub timeout: Duration,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,19 +16,20 @@ default = [ "vendored-lua" ]
|
|||
vendored-lua = [ "mlua/vendored" ]
|
||||
|
||||
[dependencies]
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-binding = { path = "../yazi-binding", version = "26.1.22" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" }
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.1.22" }
|
||||
yazi-binding = { path = "../yazi-binding", version = "26.1.22" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.1.22" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.1.22" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.1.22" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.1.22" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
yazi-proxy = { path = "../yazi-proxy", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.1.22" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.1.22" }
|
||||
yazi-widgets = { path = "../yazi-widgets", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use mlua::{Function, IntoLua, IntoLuaMulti, Lua, Value};
|
||||
use yazi_adapter::{Dimension, EMULATOR};
|
||||
use yazi_binding::{Composer, ComposerGet, ComposerSet};
|
||||
use yazi_emulator::{Dimension, EMULATOR};
|
||||
|
||||
pub(super) fn term() -> Composer<ComposerGet, ComposerSet> {
|
||||
fn get(lua: &Lua, key: &[u8]) -> mlua::Result<Value> {
|
||||
|
|
|
|||
|
|
@ -18,5 +18,4 @@ yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
|||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -13,12 +13,9 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
crossterm = { workspace = true }
|
||||
parking_lot = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
libc = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ yazi-config = { path = "../yazi-config", version = "26.1.22" }
|
|||
yazi-macro = { path = "../yazi-macro", version = "26.1.22" }
|
||||
yazi-parser = { path = "../yazi-parser", version = "26.1.22" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.1.22" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.1.22" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.1.22" }
|
||||
|
||||
# External dependencies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue