mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: failed to parse certain image dimensions for Überzug++ backend (#2020)
This commit is contained in:
parent
7498b97251
commit
0b340b67d5
4 changed files with 16 additions and 12 deletions
14
Cargo.lock
generated
14
Cargo.lock
generated
|
|
@ -360,9 +360,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.38"
|
version = "0.4.39"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
|
@ -1397,9 +1397,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.167"
|
version = "0.2.168"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
|
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libfuzzer-sys"
|
name = "libfuzzer-sys"
|
||||||
|
|
@ -2210,15 +2210,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.38.41"
|
version = "0.38.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6"
|
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ crossterm = { version = "0.28.1", features = [ "event-stream" ] }
|
||||||
dirs = "5.0.1"
|
dirs = "5.0.1"
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
globset = "0.4.15"
|
globset = "0.4.15"
|
||||||
libc = "0.2.167"
|
libc = "0.2.168"
|
||||||
md-5 = "0.10.6"
|
md-5 = "0.10.6"
|
||||||
mlua = { version = "0.10.2", 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"
|
parking_lot = "0.12.3"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use std::{path::{Path, PathBuf}, process::Stdio};
|
use std::{path::{Path, PathBuf}, process::Stdio};
|
||||||
|
|
||||||
use anyhow::{Result, bail};
|
use anyhow::{Result, bail};
|
||||||
|
use image::ImageReader;
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
|
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
|
|
@ -47,7 +48,10 @@ impl Ueberzug {
|
||||||
};
|
};
|
||||||
|
|
||||||
let p = path.to_owned();
|
let p = path.to_owned();
|
||||||
let (w, h) = tokio::task::spawn_blocking(move || image::image_dimensions(p)).await??;
|
let (w, h) = tokio::task::spawn_blocking(move || {
|
||||||
|
ImageReader::open(p)?.with_guessed_format()?.into_dimensions()
|
||||||
|
})
|
||||||
|
.await??;
|
||||||
|
|
||||||
let area = Dimension::ratio()
|
let area = Dimension::ratio()
|
||||||
.map(|(r1, r2)| Rect {
|
.map(|(r1, r2)| Rect {
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ These files are already included with Yazi when you install the release, so you
|
||||||
|
|
||||||
However, if you want to customize certain configurations:
|
However, if you want to customize certain configurations:
|
||||||
|
|
||||||
- Create a `yazi.toml` in your config directory to override the settings in [`yazi-default.toml`][yazi-default], so either:
|
- Create a `yazi.toml` in your config directory to override certain settings in [`yazi-default.toml`][yazi-default], so either:
|
||||||
- `~/.config/yazi/yazi.toml` on Unix-like systems
|
- `~/.config/yazi/yazi.toml` on Unix-like systems
|
||||||
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\yazi.toml` on Windows
|
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\yazi.toml` on Windows
|
||||||
- Create a `keymap.toml` in your config directory to override the settings in [`keymap-default.toml`][keymap-default], so either:
|
- Create a `keymap.toml` in your config directory to override certain settings in [`keymap-default.toml`][keymap-default], so either:
|
||||||
- `~/.config/yazi/keymap.toml` on Unix-like systems
|
- `~/.config/yazi/keymap.toml` on Unix-like systems
|
||||||
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\keymap.toml` on Windows
|
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\keymap.toml` on Windows
|
||||||
- Create a `theme.toml` in your config directory to override the settings in [`theme-light.toml`][theme-light] and [`theme-dark.toml`][theme-dark], so either:
|
- Create a `theme.toml` in your config directory to override certain settings in [`theme-light.toml`][theme-light] and [`theme-dark.toml`][theme-dark], so either:
|
||||||
- `~/.config/yazi/theme.toml` on Unix-like systems
|
- `~/.config/yazi/theme.toml` on Unix-like systems
|
||||||
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\theme.toml` on Windows
|
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\theme.toml` on Windows
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue