Skip to content

Commit a117530

Browse files
authored
Merge branch 'sxyazi:main' into enhance-bulk-rename
2 parents 1a194a8 + 83f4dee commit a117530

File tree

137 files changed

+1668
-1972
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1668
-1972
lines changed

Cargo.lock

Lines changed: 31 additions & 340 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ regex = "1.11.1"
3737
scopeguard = "1.2.0"
3838
serde = { version = "1.0.219", features = [ "derive" ] }
3939
serde_json = "1.0.140"
40+
syntect = { version = "5.2.0", default-features = false, features = [ "parsing", "plist-load", "regex-onig" ] }
4041
tokio = { version = "1.44.1", features = [ "full" ] }
4142
tokio-stream = "0.1.17"
4243
tokio-util = "0.7.14"

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"0.2","language":"en","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","prebuild","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"],"flagWords":[]}
1+
{"version":"0.2","language":"en","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"],"flagWords":[]}

yazi-adapter/src/drivers/iip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use base64::{Engine, engine::{Config, general_purpose::STANDARD}};
55
use crossterm::{cursor::MoveTo, queue};
66
use image::{DynamicImage, ExtendedColorType, ImageEncoder, codecs::{jpeg::JpegEncoder, png::PngEncoder}};
77
use ratatui::layout::Rect;
8-
use yazi_config::PREVIEW;
8+
use yazi_config::YAZI;
99

1010
use crate::{CLOSE, Emulator, Image, START, adapter::Adapter};
1111

@@ -44,7 +44,7 @@ impl Iip {
4444
if img.color().has_alpha() {
4545
PngEncoder::new(&mut b).write_image(&img.into_rgba8(), w, h, ExtendedColorType::Rgba8)?;
4646
} else {
47-
JpegEncoder::new_with_quality(&mut b, PREVIEW.image_quality).encode_image(&img)?;
47+
JpegEncoder::new_with_quality(&mut b, YAZI.preview.image_quality).encode_image(&img)?;
4848
};
4949

5050
let mut buf = String::with_capacity(

yazi-adapter/src/drivers/sixel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use color_quant::NeuQuant;
55
use crossterm::{cursor::MoveTo, queue};
66
use image::DynamicImage;
77
use ratatui::layout::Rect;
8-
use yazi_config::PREVIEW;
8+
use yazi_config::YAZI;
99

1010
use crate::{CLOSE, ESCAPE, Emulator, Image, START, adapter::Adapter};
1111

@@ -44,7 +44,7 @@ impl Sixel {
4444

4545
tokio::task::spawn_blocking(move || {
4646
let img = img.into_rgba8();
47-
let nq = NeuQuant::new(PREVIEW.sixel_fraction as i32, 256 - alpha as usize, &img);
47+
let nq = NeuQuant::new(YAZI.preview.sixel_fraction as i32, 256 - alpha as usize, &img);
4848

4949
let mut buf: Vec<u8> = Vec::with_capacity(1 << 16);
5050
write!(buf, "{START}P0;1;8q\"1;1;{};{}", img.width(), img.height())?;

yazi-adapter/src/drivers/ueberzug.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use image::ImageReader;
55
use ratatui::layout::Rect;
66
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
77
use tracing::{debug, warn};
8-
use yazi_config::PREVIEW;
8+
use yazi_config::YAZI;
99
use yazi_shared::{LOG_LEVEL, RoCell, env_exists};
1010

1111
use crate::{Adapter, Dimension};
@@ -57,8 +57,8 @@ impl Ueberzug {
5757
.map(|(r1, r2)| Rect {
5858
x: max.x,
5959
y: max.y,
60-
width: max.width.min((w.min(PREVIEW.max_width as _) as f64 / r1).ceil() as _),
61-
height: max.height.min((h.min(PREVIEW.max_height as _) as f64 / r2).ceil() as _),
60+
width: max.width.min((w.min(YAZI.preview.max_width as _) as f64 / r1).ceil() as _),
61+
height: max.height.min((h.min(YAZI.preview.max_height as _) as f64 / r2).ceil() as _),
6262
})
6363
.unwrap_or(max);
6464

@@ -101,8 +101,8 @@ impl Ueberzug {
101101
}
102102

103103
fn adjust_rect(mut rect: Rect) -> Rect {
104-
let scale = PREVIEW.ueberzug_scale;
105-
let (x, y, w, h) = PREVIEW.ueberzug_offset;
104+
let scale = YAZI.preview.ueberzug_scale;
105+
let (x, y, w, h) = YAZI.preview.ueberzug_offset;
106106

107107
rect.x = 0f32.max(rect.x as f32 * scale + x) as u16;
108108
rect.y = 0f32.max(rect.y as f32 * scale + y) as u16;

yazi-adapter/src/image.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
33
use anyhow::Result;
44
use image::{DynamicImage, ExtendedColorType, ImageDecoder, ImageEncoder, ImageError, ImageReader, ImageResult, Limits, codecs::{jpeg::JpegEncoder, png::PngEncoder}, imageops::FilterType, metadata::Orientation};
55
use ratatui::layout::Rect;
6-
use yazi_config::{PREVIEW, TASKS};
6+
use yazi_config::YAZI;
77

88
use crate::Dimension;
99

@@ -12,7 +12,7 @@ pub struct Image;
1212
impl Image {
1313
pub async fn precache(path: &Path, cache: PathBuf) -> Result<()> {
1414
let (mut img, orientation, icc) = Self::decode_from(path).await?;
15-
let (w, h) = Self::flip_size(orientation, (PREVIEW.max_width, PREVIEW.max_height));
15+
let (w, h) = Self::flip_size(orientation, (YAZI.preview.max_width, YAZI.preview.max_height));
1616

1717
let buf = tokio::task::spawn_blocking(move || {
1818
if img.width() > w || img.height() > h {
@@ -29,7 +29,7 @@ impl Image {
2929
icc.map(|b| encoder.set_icc_profile(b));
3030
encoder.write_image(&rgba, rgba.width(), rgba.height(), ExtendedColorType::Rgba8)?;
3131
} else {
32-
let mut encoder = JpegEncoder::new_with_quality(&mut buf, PREVIEW.image_quality);
32+
let mut encoder = JpegEncoder::new_with_quality(&mut buf, YAZI.preview.image_quality);
3333
icc.map(|b| encoder.set_icc_profile(b));
3434
encoder.encode_image(&img.into_rgb8())?;
3535
}
@@ -68,9 +68,9 @@ impl Image {
6868
Dimension::ratio()
6969
.map(|(r1, r2)| {
7070
let (w, h) = ((rect.width as f64 * r1) as u32, (rect.height as f64 * r2) as u32);
71-
(w.min(PREVIEW.max_width), h.min(PREVIEW.max_height))
71+
(w.min(YAZI.preview.max_width), h.min(YAZI.preview.max_height))
7272
})
73-
.unwrap_or((PREVIEW.max_width, PREVIEW.max_height))
73+
.unwrap_or((YAZI.preview.max_width, YAZI.preview.max_height))
7474
}
7575

7676
pub(super) fn pixel_area(size: (u32, u32), rect: Rect) -> Rect {
@@ -86,7 +86,7 @@ impl Image {
8686

8787
#[inline]
8888
fn filter() -> FilterType {
89-
match PREVIEW.image_filter.as_str() {
89+
match YAZI.preview.image_filter.as_str() {
9090
"nearest" => FilterType::Nearest,
9191
"triangle" => FilterType::Triangle,
9292
"catmull-rom" => FilterType::CatmullRom,
@@ -98,14 +98,14 @@ impl Image {
9898

9999
async fn decode_from(path: &Path) -> ImageResult<(DynamicImage, Orientation, Option<Vec<u8>>)> {
100100
let mut limits = Limits::no_limits();
101-
if TASKS.image_alloc > 0 {
102-
limits.max_alloc = Some(TASKS.image_alloc as u64);
101+
if YAZI.tasks.image_alloc > 0 {
102+
limits.max_alloc = Some(YAZI.tasks.image_alloc as u64);
103103
}
104-
if TASKS.image_bound[0] > 0 {
105-
limits.max_image_width = Some(TASKS.image_bound[0] as u32);
104+
if YAZI.tasks.image_bound[0] > 0 {
105+
limits.max_image_width = Some(YAZI.tasks.image_bound[0] as u32);
106106
}
107-
if TASKS.image_bound[1] > 0 {
108-
limits.max_image_height = Some(TASKS.image_bound[1] as u32);
107+
if YAZI.tasks.image_bound[1] > 0 {
108+
limits.max_image_height = Some(YAZI.tasks.image_bound[1] as u32);
109109
}
110110

111111
let path = path.to_owned();

yazi-boot/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ regex = { workspace = true }
2121
serde = { workspace = true }
2222

2323
[build-dependencies]
24+
yazi-shared = { path = "../yazi-shared", version = "25.3.7" }
25+
26+
# External dependencies
2427
clap = { workspace = true }
25-
clap_complete = "4.5.46"
28+
clap_complete = "4.5.47"
2629
clap_complete_fig = "4.5.2"
2730
clap_complete_nushell = "4.5.5"
2831
vergen-gitcl = { version = "1.0.5", features = [ "build", "rustc" ] }

yazi-boot/src/actions/clear_cache.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
use yazi_config::PREVIEW;
1+
use yazi_config::YAZI;
22
use yazi_fs::Xdg;
33

44
use super::Actions;
55

66
impl Actions {
77
pub(super) fn clear_cache() {
8-
if PREVIEW.cache_dir == Xdg::cache_dir() {
9-
println!("Clearing cache directory: \n{:?}", PREVIEW.cache_dir);
10-
std::fs::remove_dir_all(&PREVIEW.cache_dir).unwrap();
8+
if YAZI.preview.cache_dir == Xdg::cache_dir() {
9+
println!("Clearing cache directory: \n{:?}", YAZI.preview.cache_dir);
10+
std::fs::remove_dir_all(&YAZI.preview.cache_dir).unwrap();
1111
} else {
1212
println!(
1313
"You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}",
14-
PREVIEW.cache_dir
14+
YAZI.preview.cache_dir
1515
);
1616
}
1717
}

yazi-boot/src/actions/debug.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ impl Actions {
5656
writeln!(
5757
s,
5858
" default : {:?}",
59-
yazi_config::OPEN.openers("f75a.txt", "text/plain").and_then(|a| a.first().cloned())
59+
yazi_config::YAZI.opener.first(yazi_config::YAZI.open.all("f75a.txt", "text/plain"))
6060
)?;
6161
writeln!(
6262
s,
6363
" block-create: {:?}",
64-
yazi_config::OPEN.block_opener("bulk-create.txt", "text/plain")
64+
yazi_config::YAZI.opener.block(yazi_config::YAZI.open.all("bulk-create.txt", "text/plain"))
6565
)?;
6666
writeln!(
6767
s,
6868
" block-rename: {:?}",
69-
yazi_config::OPEN.block_opener("bulk-rename.txt", "text/plain")
69+
yazi_config::YAZI.opener.block(yazi_config::YAZI.open.all("bulk-rename.txt", "text/plain"))
7070
)?;
7171

7272
writeln!(s, "\nMultiplexers")?;

0 commit comments

Comments
 (0)