Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new load DDS event #1980

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 84 additions & 118 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ crossterm = { version = "0.28.1", features = [ "event-stream" ] }
dirs = "5.0.1"
futures = "0.3.31"
globset = "0.4.15"
libc = "0.2.166"
libc = "0.2.167"
md-5 = "0.10.6"
mlua = { version = "0.10.1", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
mlua = { version = "0.10.2", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
parking_lot = "0.12.3"
ratatui = { version = "0.29.0", features = [ "unstable-rendered-line-info" ] }
regex = "1.11.1"
Expand Down
1 change: 1 addition & 0 deletions yazi-boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = "https://github.com/sxyazi/yazi"
[dependencies]
yazi-adapter = { path = "../yazi-adapter", version = "0.3.3" }
yazi-config = { path = "../yazi-config", version = "0.3.3" }
yazi-fs = { path = "../yazi-fs", version = "0.3.3" }
yazi-macro = { path = "../yazi-macro", version = "0.3.3" }
yazi-shared = { path = "../yazi-shared", version = "0.3.3" }

Expand Down
2 changes: 1 addition & 1 deletion yazi-boot/src/actions/clear_cache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use yazi_config::PREVIEW;
use yazi_shared::Xdg;
use yazi_fs::Xdg;

use super::Actions;

Expand Down
2 changes: 1 addition & 1 deletion yazi-boot/src/boot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::HashSet, ffi::OsString, path::PathBuf};

use serde::Serialize;
use yazi_shared::{Xdg, fs::{current_cwd, expand_path}};
use yazi_fs::{Xdg, current_cwd, expand_path};

#[derive(Debug, Default, Serialize)]
pub struct Boot {
Expand Down
1 change: 1 addition & 0 deletions yazi-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = "https://github.com/sxyazi/yazi"
[dependencies]
yazi-boot = { path = "../yazi-boot", version = "0.3.3" }
yazi-dds = { path = "../yazi-dds", version = "0.3.3" }
yazi-fs = { path = "../yazi-fs", version = "0.3.3" }
yazi-macro = { path = "../yazi-macro", version = "0.3.3" }
yazi-shared = { path = "../yazi-shared", version = "0.3.3" }

Expand Down
2 changes: 1 addition & 1 deletion yazi-cli/src/package/add.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use yazi_shared::fs::must_exists;
use yazi_fs::must_exists;

use super::{Git, Package};

Expand Down
2 changes: 1 addition & 1 deletion yazi-cli/src/package/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::PathBuf;

use anyhow::{Context, Result, bail};
use tokio::fs;
use yazi_shared::{Xdg, fs::{maybe_exists, must_exists, remove_dir_clean}};
use yazi_fs::{Xdg, maybe_exists, must_exists, remove_dir_clean};

use super::Package;

Expand Down
2 changes: 1 addition & 1 deletion yazi-cli/src/package/install.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use yazi_shared::fs::must_exists;
use yazi_fs::must_exists;

use super::{Git, Package};

Expand Down
3 changes: 2 additions & 1 deletion yazi-cli/src/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
yazi_macro::mod_flat!(add deploy git install package parser upgrade);

use anyhow::Context;
use yazi_fs::Xdg;

pub(super) fn init() -> anyhow::Result<()> {
let root = yazi_shared::Xdg::state_dir().join("packages");
let root = Xdg::state_dir().join("packages");
std::fs::create_dir_all(&root)
.with_context(|| format!("failed to create packages directory: {root:?}"))?;

Expand Down
2 changes: 1 addition & 1 deletion yazi-cli/src/package/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{borrow::Cow, io::BufWriter, path::PathBuf};

use anyhow::Result;
use md5::{Digest, Md5};
use yazi_shared::Xdg;
use yazi_fs::Xdg;

pub(crate) struct Package {
pub(crate) repo: String,
Expand Down
2 changes: 1 addition & 1 deletion yazi-cli/src/package/parser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{Context, Result, bail};
use tokio::fs;
use toml_edit::{Array, DocumentMut, InlineTable, Item, Value};
use yazi_shared::Xdg;
use yazi_fs::Xdg;

use super::Package;

Expand Down
2 changes: 1 addition & 1 deletion yazi-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ proc-macro = true

[dependencies]
# External dependencies
syn = "2.0.89"
syn = "2.0.90"
quote = "1.0.37"
3 changes: 2 additions & 1 deletion yazi-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ homepage = "https://yazi-rs.github.io"
repository = "https://github.com/sxyazi/yazi"

[dependencies]
yazi-fs = { path = "../yazi-fs", version = "0.3.3" }
yazi-macro = { path = "../yazi-macro", version = "0.3.3" }
yazi-shared = { path = "../yazi-shared", version = "0.3.3" }

Expand All @@ -17,7 +18,7 @@ anyhow = { workspace = true }
bitflags = { workspace = true }
crossterm = { workspace = true }
globset = { workspace = true }
indexmap = { version = "2.6.0", features = [ "serde" ] }
indexmap = { version = "2.7.0", features = [ "serde" ] }
ratatui = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions yazi-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yazi_macro::mod_flat!(layout pattern preset priority);

use std::str::FromStr;

use yazi_shared::{RoCell, SyncCell, Xdg};
use yazi_shared::{RoCell, SyncCell};

pub static KEYMAP: RoCell<keymap::Keymap> = RoCell::new();
pub static MANAGER: RoCell<manager::Manager> = RoCell::new();
Expand Down Expand Up @@ -74,15 +74,15 @@ pub fn init_flavor(light: bool) -> anyhow::Result<()> {
theme.manager.syntect_theme = theme
.flavor
.syntect_path(light)
.unwrap_or_else(|| yazi_shared::fs::expand_path(&theme.manager.syntect_theme));
.unwrap_or_else(|| yazi_fs::expand_path(&theme.manager.syntect_theme));

THEME.init(theme);
Ok(())
}

fn try_init(merge: bool) -> anyhow::Result<()> {
let (yazi_toml, keymap_toml) = if merge {
let p = Xdg::config_dir();
let p = yazi_fs::Xdg::config_dir();
(Preset::yazi(&p)?, Preset::keymap(&p)?)
} else {
(yazi_macro::config_preset!("yazi"), yazi_macro::config_preset!("keymap"))
Expand Down
3 changes: 2 additions & 1 deletion yazi-config/src/manager/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::str::FromStr;
use anyhow::Context;
use serde::{Deserialize, Serialize};
use validator::Validate;
use yazi_fs::SortBy;

use super::{ManagerRatio, MouseEvents, SortBy};
use super::{ManagerRatio, MouseEvents};

#[derive(Debug, Deserialize, Serialize, Validate)]
pub struct Manager {
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/manager/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yazi_macro::mod_flat!(manager mouse ratio sorting);
yazi_macro::mod_flat!(manager mouse ratio);
2 changes: 1 addition & 1 deletion yazi-config/src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Pattern {

#[cfg(windows)]
let path = if self.sep_lit {
yazi_shared::fs::backslash_to_slash(path.as_ref())
yazi_fs::backslash_to_slash(path.as_ref())
} else {
std::borrow::Cow::Borrowed(path.as_ref())
};
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/plugin/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::HashSet, path::Path, str::FromStr};
use anyhow::Context;
use serde::{Deserialize, Deserializer};
use tracing::warn;
use yazi_shared::fs::File;
use yazi_fs::File;

use super::{Fetcher, Preloader, Previewer, Spotter};
use crate::{Preset, plugin::MAX_PREWORKERS};
Expand Down
6 changes: 3 additions & 3 deletions yazi-config/src/popup/options.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ratatui::{text::Text, widgets::{Paragraph, Wrap}};
use yazi_shared::fs::Url;
use yazi_shared::url::Url;

use super::{Offset, Origin, Position};
use crate::{CONFIRM, INPUT, PICK};
Expand Down Expand Up @@ -119,7 +119,7 @@ impl ConfirmCfg {
}
}

pub fn trash(urls: &[yazi_shared::fs::Url]) -> Self {
pub fn trash(urls: &[yazi_shared::url::Url]) -> Self {
Self::new(
Self::replace_number(&CONFIRM.trash_title, urls.len()),
(CONFIRM.trash_origin, CONFIRM.trash_offset),
Expand All @@ -128,7 +128,7 @@ impl ConfirmCfg {
)
}

pub fn delete(urls: &[yazi_shared::fs::Url]) -> Self {
pub fn delete(urls: &[yazi_shared::url::Url]) -> Self {
Self::new(
Self::replace_number(&CONFIRM.delete_title, urls.len()),
(CONFIRM.delete_origin, CONFIRM.delete_offset),
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/preset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{borrow::Cow, path::{Path, PathBuf}, str::FromStr};

use anyhow::{Context, Result};
use toml::{Table, Value};
use yazi_shared::Xdg;
use yazi_fs::Xdg;

use crate::theme::Flavor;

Expand Down
4 changes: 2 additions & 2 deletions yazi-config/src/preview/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::{borrow::Cow, path::PathBuf, str::FromStr};
use anyhow::Context;
use serde::{Deserialize, Deserializer, Serialize};
use validator::Validate;
use yazi_shared::{fs::expand_path, timestamp_us};
use yazi_fs::{Xdg, expand_path};
use yazi_shared::timestamp_us;

use super::PreviewWrap;
use crate::Xdg;

#[rustfmt::skip]
const TABS: &[&str] = &["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "];
Expand Down
3 changes: 2 additions & 1 deletion yazi-config/src/theme/filetype.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use serde::{Deserialize, Deserializer};
use yazi_shared::{fs::File, theme::{Color, Style, StyleShadow}};
use yazi_fs::File;
use yazi_shared::theme::{Color, Style, StyleShadow};

use super::Is;
use crate::Pattern;
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/theme/flavor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{borrow::Cow, path::PathBuf, str::FromStr};

use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use yazi_shared::Xdg;
use yazi_fs::Xdg;

#[derive(Default, Deserialize, Serialize)]
pub struct Flavor {
Expand Down
3 changes: 2 additions & 1 deletion yazi-config/src/theme/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::collections::HashMap;

use anyhow::Result;
use serde::{Deserialize, Deserializer};
use yazi_shared::{Condition, fs::File, theme::{Color, Icon, Style}};
use yazi_fs::File;
use yazi_shared::{Condition, theme::{Color, Icon, Style}};

use crate::{Pattern, Preset};

Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/theme/is.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::str::FromStr;

use anyhow::bail;
use serde::Deserialize;
use yazi_shared::fs::Cha;
use yazi_fs::Cha;

#[derive(Default, Deserialize)]
#[serde(try_from = "String")]
Expand Down
3 changes: 2 additions & 1 deletion yazi-core/src/manager/commands/bulk_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use scopeguard::defer;
use tokio::{fs::{self, OpenOptions}, io::{AsyncReadExt, AsyncWriteExt, stdin}};
use yazi_config::{OPEN, PREVIEW};
use yazi_dds::Pubsub;
use yazi_fs::{File, FilesOp, max_common_root, maybe_exists, paths_to_same_file};
use yazi_proxy::{AppProxy, HIDER, TasksProxy, WATCHER};
use yazi_shared::{fs::{File, FilesOp, Url, max_common_root, maybe_exists, paths_to_same_file}, terminal_clear};
use yazi_shared::{terminal_clear, url::Url};

use crate::manager::Manager;

Expand Down
3 changes: 2 additions & 1 deletion yazi-core/src/manager/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::collections::{HashMap, HashSet};
use anyhow::Result;
use tokio::fs;
use yazi_config::popup::{ConfirmCfg, InputCfg};
use yazi_fs::{File, FilesOp, maybe_exists, ok_or_not_found, realname};
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
use yazi_shared::{event::CmdCow, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, realname}};
use yazi_shared::{event::CmdCow, url::{Url, UrnBuf}};

use crate::manager::Manager;

Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/manager/commands/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashSet, path::PathBuf};

use yazi_dds::Pubsub;
use yazi_macro::render;
use yazi_shared::{Id, event::{CmdCow, Data}, fs::{Url, Urn}};
use yazi_shared::{Id, event::{CmdCow, Data}, url::{Url, Urn}};

use crate::manager::Manager;

Expand Down
6 changes: 3 additions & 3 deletions yazi-core/src/manager/commands/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::{borrow::Cow, ffi::OsString};
use tracing::error;
use yazi_boot::ARGS;
use yazi_config::{OPEN, PLUGIN, popup::PickCfg};
use yazi_fs::Folder;
use yazi_fs::File;
use yazi_macro::emit;
use yazi_plugin::isolate;
use yazi_proxy::{ManagerProxy, TasksProxy, options::OpenDoOpt};
use yazi_shared::{MIME_DIR, event::{CmdCow, EventQuit}, fs::{File, Url}};
use yazi_shared::{MIME_DIR, event::{CmdCow, EventQuit}, url::Url};

use crate::{manager::Manager, tasks::Tasks};
use crate::{manager::Manager, tab::Folder, tasks::Tasks};

#[derive(Clone, Copy)]
struct Opt {
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/manager/commands/peek.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use yazi_proxy::HIDER;
use yazi_shared::{event::{CmdCow, Data}, fs::Url};
use yazi_shared::{event::{CmdCow, Data}, url::Url};

use crate::manager::Manager;

Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/manager/commands/remove.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use yazi_config::popup::ConfirmCfg;
use yazi_proxy::{ConfirmProxy, ManagerProxy};
use yazi_shared::{event::CmdCow, fs::Url};
use yazi_shared::{event::CmdCow, url::Url};

use crate::{manager::Manager, tasks::Tasks};

Expand Down
7 changes: 4 additions & 3 deletions yazi-core/src/manager/commands/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use anyhow::Result;
use tokio::fs;
use yazi_config::popup::{ConfirmCfg, InputCfg};
use yazi_dds::Pubsub;
use yazi_fs::{File, FilesOp, maybe_exists, ok_or_not_found, paths_to_same_file, realname};
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
use yazi_shared::{event::CmdCow, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, paths_to_same_file, realname}};
use yazi_shared::{Id, event::CmdCow, url::{Url, UrnBuf}};

use crate::manager::Manager;

Expand Down Expand Up @@ -53,7 +54,7 @@ impl Manager {
_ => None,
};

let tab = self.tabs.cursor;
let tab = self.tabs.active().id;
tokio::spawn(async move {
let mut result = InputProxy::show(InputCfg::rename().with_value(name).with_cursor(cursor));
let Some(Ok(name)) = result.recv().await else {
Expand All @@ -73,7 +74,7 @@ impl Manager {
});
}

async fn rename_do(tab: usize, old: Url, new: Url) -> Result<()> {
async fn rename_do(tab: Id, old: Url, new: Url) -> Result<()> {
let Some((p_old, n_old)) = old.pair() else { return Ok(()) };
let Some((p_new, n_new)) = new.pair() else { return Ok(()) };
let _permit = WATCHER.acquire().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/manager/commands/tab_create.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use yazi_boot::BOOT;
use yazi_macro::render;
use yazi_proxy::AppProxy;
use yazi_shared::{event::CmdCow, fs::Url};
use yazi_shared::{event::CmdCow, url::Url};

use crate::{manager::Tabs, tab::Tab};

Expand Down
Loading
Loading