rerstore firmatting diffs

This commit is contained in:
Ahmed Hassan 2025-07-30 06:28:55 +04:00
parent 518612857b
commit 83b46c8230
6 changed files with 69 additions and 147 deletions

View file

@ -1 +1 @@
{"version":"0.2","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","peekable","ratatui","syntect","pbpaste","pbcopy","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","Konsole","Überzug","pkgs","pdftoppm","poppler","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind","Rustc","rustc","ffprobe","vframes","luma","obase","outln","errln","tmtheme","twox","cfgs","fstype","objc","rdev","runloop","exfat","rclone","DECRQSS","DECSCUSR","libvterm","Uninit","lockin","rposition","resvg","foldhash","tilded"],"language":"en"}
{"version":"0.2","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","peekable","ratatui","syntect","pbpaste","pbcopy","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","Konsole","Überzug","pkgs","pdftoppm","poppler","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind","Rustc","rustc","ffprobe","vframes","luma","obase","outln","errln","tmtheme","twox","cfgs","fstype","objc","rdev","runloop","exfat","rclone","DECRQSS","DECSCUSR","libvterm","Uninit","lockin","rposition","resvg","foldhash","tilded"],"language":"en"}

View file

@ -6,10 +6,7 @@ use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
use yazi_config::popup::InputCfg;
use yazi_fs::{FilesOp, cha::Cha};
use yazi_macro::{act, succ};
use yazi_parser::{
VoidOpt,
mgr::{SearchOpt, SearchOptVia},
};
use yazi_parser::{VoidOpt, mgr::{SearchOpt, SearchOptVia}};
use yazi_plugin::external;
use yazi_proxy::{InputProxy, MgrProxy};
use yazi_shared::event::Data;
@ -123,4 +120,4 @@ impl Actor for SearchStop {
}
succ!();
}
}
}

View file

@ -1,7 +1,4 @@
use std::{
fs::{FileType, Metadata},
time::SystemTime,
};
use std::{fs::{FileType, Metadata}, time::SystemTime};
use yazi_macro::{unix_either, win_either};
use yazi_shared::url::Url;
@ -11,21 +8,21 @@ use crate::services;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Cha {
pub kind: ChaKind,
pub len: u64,
pub kind: ChaKind,
pub len: u64,
pub atime: Option<SystemTime>,
pub btime: Option<SystemTime>,
#[cfg(unix)]
pub ctime: Option<SystemTime>,
pub mtime: Option<SystemTime>,
#[cfg(unix)]
pub mode: libc::mode_t,
pub mode: libc::mode_t,
#[cfg(unix)]
pub dev: libc::dev_t,
pub dev: libc::dev_t,
#[cfg(unix)]
pub uid: libc::uid_t,
pub uid: libc::uid_t,
#[cfg(unix)]
pub gid: libc::gid_t,
pub gid: libc::gid_t,
#[cfg(unix)]
pub nlink: libc::nlink_t,
}
@ -33,23 +30,23 @@ pub struct Cha {
impl Default for Cha {
fn default() -> Self {
Self {
kind: ChaKind::DUMMY,
len: 0,
atime: None,
btime: None,
kind: ChaKind::DUMMY,
len: 0,
atime: None,
btime: None,
#[cfg(unix)]
ctime: None,
mtime: None,
ctime: None,
mtime: None,
#[cfg(unix)]
mode: 0,
mode: 0,
#[cfg(unix)]
dev: 0,
dev: 0,
#[cfg(unix)]
uid: 0,
uid: 0,
#[cfg(unix)]
gid: 0,
gid: 0,
#[cfg(unix)]
nlink: 0,
nlink: 0,
}
}
}
@ -132,10 +129,7 @@ impl Cha {
fn from_just_meta(m: &Metadata) -> Self {
#[cfg(unix)]
use std::{
os::unix::{fs::MetadataExt, prelude::PermissionsExt},
time::{Duration, UNIX_EPOCH},
};
use std::{os::unix::{fs::MetadataExt, prelude::PermissionsExt}, time::{Duration, UNIX_EPOCH}};
let mut kind = ChaKind::empty();
if m.is_dir() {
@ -184,9 +178,7 @@ impl Cha {
impl Cha {
#[inline]
pub const fn is_dir(&self) -> bool {
self.kind.contains(ChaKind::DIR)
}
pub const fn is_dir(&self) -> bool { self.kind.contains(ChaKind::DIR) }
#[inline]
pub const fn is_hidden(&self) -> bool {
@ -197,19 +189,13 @@ impl Cha {
}
#[inline]
pub const fn is_link(&self) -> bool {
self.kind.contains(ChaKind::LINK)
}
pub const fn is_link(&self) -> bool { self.kind.contains(ChaKind::LINK) }
#[inline]
pub const fn is_orphan(&self) -> bool {
self.kind.contains(ChaKind::ORPHAN)
}
pub const fn is_orphan(&self) -> bool { self.kind.contains(ChaKind::ORPHAN) }
#[inline]
pub const fn is_dummy(&self) -> bool {
self.kind.contains(ChaKind::DUMMY)
}
pub const fn is_dummy(&self) -> bool { self.kind.contains(ChaKind::DUMMY) }
#[inline]
pub const fn is_block(&self) -> bool {
@ -232,12 +218,8 @@ impl Cha {
}
#[inline]
pub const fn is_exec(&self) -> bool {
unix_either!(self.mode & libc::S_IXUSR != 0, false)
}
pub const fn is_exec(&self) -> bool { unix_either!(self.mode & libc::S_IXUSR != 0, false) }
#[inline]
pub const fn is_sticky(&self) -> bool {
unix_either!(self.mode & libc::S_ISVTX != 0, false)
}
}
pub const fn is_sticky(&self) -> bool { unix_either!(self.mode & libc::S_ISVTX != 0, false) }
}

View file

@ -4,9 +4,9 @@ use yazi_shared::{SStr, event::CmdCow};
#[derive(Debug)]
pub struct SearchOpt {
pub via: SearchOptVia,
pub subject: SStr,
pub args: Vec<String>,
pub via: SearchOptVia,
pub subject: SStr,
pub args: Vec<String>,
pub args_raw: SStr,
}
@ -36,9 +36,7 @@ impl TryFrom<CmdCow> for SearchOpt {
}
impl IntoLua for &SearchOpt {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> {
Err("unsupported".into_lua_err())
}
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
}
// Via
@ -70,4 +68,4 @@ impl SearchOptVia {
Self::Es => "es",
}
}
}
}

View file

@ -2,11 +2,7 @@ use std::path::Path;
use std::process::Stdio;
use anyhow::Result;
use tokio::{
io::{AsyncBufReadExt, BufReader},
process::{Child, Command},
sync::mpsc::{self, UnboundedReceiver},
};
use tokio::{io::{AsyncBufReadExt, BufReader},process::{Child, Command},sync::mpsc::{self, UnboundedReceiver},};
use yazi_fs::File;
use yazi_shared::url::Url;

View file

@ -1,57 +1,37 @@
use std::{
borrow::Cow,
ffi::OsStr,
fmt::{Debug, Formatter},
hash::BuildHasher,
ops::Deref,
path::{Path, PathBuf},
};
use std::{borrow::Cow, ffi::OsStr, fmt::{Debug, Formatter}, hash::BuildHasher, ops::Deref, path::{Path, PathBuf}};
use percent_encoding::percent_decode;
use serde::{Deserialize, Serialize};
use super::UrnBuf;
use crate::{
IntoOsStr,
url::{Components, Display, Loc, Scheme},
};
use crate::{IntoOsStr, url::{Components, Display, Loc, Scheme}};
#[derive(Clone, Default, Eq, Ord, PartialOrd, PartialEq, Hash)]
pub struct Url {
pub loc: Loc,
pub loc: Loc,
pub scheme: Scheme,
}
impl Deref for Url {
type Target = Loc;
fn deref(&self) -> &Self::Target {
&self.loc
}
fn deref(&self) -> &Self::Target { &self.loc }
}
impl From<Loc> for Url {
fn from(loc: Loc) -> Self {
Self { loc, scheme: Scheme::Regular }
}
fn from(loc: Loc) -> Self { Self { loc, scheme: Scheme::Regular } }
}
impl From<PathBuf> for Url {
fn from(path: PathBuf) -> Self {
Loc::from(path).into()
}
fn from(path: PathBuf) -> Self { Loc::from(path).into() }
}
impl From<&PathBuf> for Url {
fn from(path: &PathBuf) -> Self {
path.to_owned().into()
}
fn from(path: &PathBuf) -> Self { path.to_owned().into() }
}
impl From<&Path> for Url {
fn from(path: &Path) -> Self {
path.to_path_buf().into()
}
fn from(path: &Path) -> Self { path.to_path_buf().into() }
}
impl TryFrom<&[u8]> for Url {
@ -73,48 +53,34 @@ impl TryFrom<&[u8]> for Url {
impl TryFrom<&str> for Url {
type Error = anyhow::Error;
fn try_from(value: &str) -> Result<Self, Self::Error> {
value.as_bytes().try_into()
}
fn try_from(value: &str) -> Result<Self, Self::Error> { value.as_bytes().try_into() }
}
impl TryFrom<String> for Url {
type Error = anyhow::Error;
fn try_from(value: String) -> Result<Self, Self::Error> {
value.as_bytes().try_into()
}
fn try_from(value: String) -> Result<Self, Self::Error> { value.as_bytes().try_into() }
}
impl AsRef<Url> for Url {
fn as_ref(&self) -> &Url {
self
}
fn as_ref(&self) -> &Url { self }
}
// FIXME: remove
impl AsRef<Path> for Url {
fn as_ref(&self) -> &Path {
&self.loc
}
fn as_ref(&self) -> &Path { &self.loc }
}
impl<'a> From<&'a Url> for Cow<'a, Url> {
fn from(url: &'a Url) -> Self {
Cow::Borrowed(url)
}
fn from(url: &'a Url) -> Self { Cow::Borrowed(url) }
}
impl From<Url> for Cow<'_, Url> {
fn from(url: Url) -> Self {
Cow::Owned(url)
}
fn from(url: Url) -> Self { Cow::Owned(url) }
}
impl From<Cow<'_, Url>> for Url {
fn from(url: Cow<'_, Url>) -> Self {
url.into_owned()
}
fn from(url: Cow<'_, Url>) -> Self { url.into_owned() }
}
impl Url {
@ -139,16 +105,16 @@ impl Url {
Scheme::SearchItem => {
Self { loc: Loc::with(self.loc.base(), self.loc.join(path)), scheme: Scheme::SearchItem }
}
Scheme::Archive(_) => Self { loc: self.loc.join(path).into(), scheme: self.scheme.clone() },
Scheme::Archive(_) => {
Self { loc: self.loc.join(path).into(), scheme: self.scheme.clone() }
}
Scheme::Sftp(_) => Self { loc: self.loc.join(path).into(), scheme: self.scheme.clone() },
}
}
// FIXME: check usages
#[inline]
pub fn components(&self) -> Components<'_> {
Components::new(self)
}
pub fn components(&self) -> Components<'_> { Components::new(self) }
#[inline]
pub fn covariant(&self, other: &Self) -> bool {
@ -156,14 +122,10 @@ impl Url {
}
#[inline]
pub fn display(&self) -> Display<'_> {
Display::new(self)
}
pub fn display(&self) -> Display<'_> { Display::new(self) }
#[inline]
pub fn os_str(&self) -> Cow<'_, OsStr> {
self.components().os_str()
}
pub fn os_str(&self) -> Cow<'_, OsStr> { self.components().os_str() }
pub fn parent_url(&self) -> Option<Url> {
let parent = self.loc.parent()?;
@ -189,7 +151,10 @@ impl Url {
return None;
}
Some(Self { loc: self.loc.strip_prefix(&base.loc).ok()?.into(), scheme: self.scheme.clone() })
Some(Self {
loc: self.loc.strip_prefix(&base.loc).ok()?.into(),
scheme: self.scheme.clone(),
})
}
#[inline]
@ -198,19 +163,13 @@ impl Url {
}
#[inline]
pub fn set_name(&mut self, name: impl AsRef<OsStr>) {
self.loc.set_name(name);
}
pub fn set_name(&mut self, name: impl AsRef<OsStr>) { self.loc.set_name(name); }
#[inline]
pub fn pair(&self) -> Option<(Self, UrnBuf)> {
Some((self.parent_url()?, self.loc.urn_owned()))
}
pub fn pair(&self) -> Option<(Self, UrnBuf)> { Some((self.parent_url()?, self.loc.urn_owned())) }
#[inline]
pub fn hash_u64(&self) -> u64 {
foldhash::fast::FixedState::default().hash_one(self)
}
pub fn hash_u64(&self) -> u64 { foldhash::fast::FixedState::default().hash_one(self) }
#[inline]
pub fn rebase(&self, parent: &Path) -> Self {
@ -222,14 +181,10 @@ impl Url {
impl Url {
// --- Regular
#[inline]
pub fn is_regular(&self) -> bool {
self.scheme == Scheme::Regular
}
pub fn is_regular(&self) -> bool { self.scheme == Scheme::Regular }
#[inline]
pub fn to_regular(&self) -> Self {
Self { loc: self.loc.clone(), scheme: Scheme::Regular }
}
pub fn to_regular(&self) -> Self { Self { loc: self.loc.clone(), scheme: Scheme::Regular } }
#[inline]
pub fn into_regular(mut self) -> Self {
@ -239,9 +194,7 @@ impl Url {
// --- Search
#[inline]
pub fn is_search(&self) -> bool {
matches!(self.scheme, Scheme::Search(_))
}
pub fn is_search(&self) -> bool { matches!(self.scheme, Scheme::Search(_)) }
#[inline]
pub fn to_search(&self, frag: impl AsRef<str>) -> Self {
@ -256,15 +209,11 @@ impl Url {
// --- Archive
#[inline]
pub fn is_archive(&self) -> bool {
matches!(self.scheme, Scheme::Archive(_))
}
pub fn is_archive(&self) -> bool { matches!(self.scheme, Scheme::Archive(_)) }
// FIXME: remove
#[inline]
pub fn into_path(self) -> PathBuf {
self.loc.into_path()
}
pub fn into_path(self) -> PathBuf { self.loc.into_path() }
}
impl Debug for Url {
@ -292,4 +241,4 @@ impl<'de> Deserialize<'de> for Url {
let s = String::deserialize(deserializer)?;
Self::try_from(s).map_err(serde::de::Error::custom)
}
}
}