Skip to content

Commit

Permalink
fix: failed to parse certain image dimensions for Überzug++ backend (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi authored Dec 9, 2024
1 parent 7498b97 commit 0b340b6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ crossterm = { version = "0.28.1", features = [ "event-stream" ] }
dirs = "5.0.1"
futures = "0.3.31"
globset = "0.4.15"
libc = "0.2.167"
libc = "0.2.168"
md-5 = "0.10.6"
mlua = { version = "0.10.2", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
parking_lot = "0.12.3"
Expand Down
6 changes: 5 additions & 1 deletion yazi-adapter/src/drivers/ueberzug.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{path::{Path, PathBuf}, process::Stdio};

use anyhow::{Result, bail};
use image::ImageReader;
use ratatui::layout::Rect;
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
use tracing::{debug, warn};
Expand Down Expand Up @@ -47,7 +48,10 @@ impl Ueberzug {
};

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()
.map(|(r1, r2)| Rect {
Expand Down
6 changes: 3 additions & 3 deletions yazi-config/preset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

- 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
- `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
- `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
- `C:\Users\USERNAME\AppData\Roaming\yazi\config\theme.toml` on Windows

Expand Down

0 comments on commit 0b340b6

Please sign in to comment.