Open codesections opened 3 years ago
Hi, thanks for the report.
It looks like the root cause stems from a call to crossterm::terminal::size
. It successfully returns an invalid value, (0, 0)
, for terminal (width, height). Because of that return value, on the viu
side (viuer
actually) incorrectly resizes the image to (0, 2)
and tries to iterate over its pixels. I should add edge case checks, but in the best case you will get a (1, 1)
image displayed until the size
function returns the correct value.
I have zero knowledge about the emacs/eshell environment so I cannot really help with fixing this upstream, sorry.
Yes, same here.
/foo $ RUST_BACKTRACE=1 viu kk.jpg
thread 'main' panicked at 'Image index (0, 1) out of bounds (0, 2)', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/image-0.23.12/./src/buffer.rs:723:21
stack backtrace:
0: rust_begin_unwind
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
1: std::panicking::begin_panic_fmt
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
2: <image::dynimage::DynamicImage as image::image::GenericImageView>::get_pixel
3: <viuer::printer::block::BlockPrinter as viuer::printer::Printer>::print
4: viuer::printer::Printer::print_from_file
5: viuer::print_from_file
6: viu::app::view_file
7: viu::app::run
8: viu::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
/foo $
Other similar app works well:
/foo $ sxiv kk.jpg
/foo $ feh kk.jpg
/foo $ display kk.jpg
Thanks for the wonderful tool! I encountered a panic when trying to use viu with eshell. The panic still happened when I ran
emacs -Q
(which runs with a blank config), so it wasn't triggered by anything in my configuration.I tested in CLI emacs inside Alacritty and Kitty and ran into the same error. (I didn't test GUI emacs, since it can display images by itself).
The backtrace is below: