sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
16.85k stars 392 forks source link

Image Preview Overflow Issue on Large Images and stay #1936

Closed lolipodass closed 3 days ago

lolipodass commented 3 days ago

What system are you running Yazi on?

Windows

What terminal are you running Yazi in?

wezterm 20240203-110809-5046fc22

yazi --debug output

Yazi
    Version: 0.3.3 (7c445ce 2024-09-04)
    Debug  : false
    OS     : windows-x86_64 (windows)

Ya
    Version: 0.3.3 (7c445ce 2024-09-04)

Emulator
    Emulator.via_env: ("xterm-256color", "WezTerm")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : WezTerm

Adapter
    Adapter.matches: Iterm2

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : None
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : None
    EDITOR             : None
    VISUAL             : None
    YAZI_FILE_ONE      : Some("C:\\Program Files\\Git\\usr\\bin\\file.exe")
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "code %*", block: false, orphan: true, desc: "code", for_: None, spread: true })
    block  : Some(Opener { run: "code -w %*", block: true, orphan: false, desc:
"code (block)", for_: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : program not found
    ZELLIJ_SESSION_NAME: None
    Zellij version     : program not found

Dependencies
    file             : 5.45
    ueberzugpp       : program not found
    ffmpegthumbnailer: program not found
    magick           : 7.1.1-41
    fzf              : 0.56.3
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : program not found
    zoxide           : 0.9.6
    7z               : 3.1
    7zz              : program not found
    jq               : 1.7.1

Describe the bug

When previewing large images, parts of the image that exceed the standart preview boundaries remain visible even after switching to a different object.
image image image

Minimal reproducer

  1. open image that bigger that preview area(it is very easy to perform by reducing the size of the window)
  2. change selection to different item

Anything else?

No response

Validations

sxyazi commented 3 days ago

See https://yazi-rs.github.io/docs/image-preview#size

lolipodass commented 3 days ago

@sxyazi I probably expressed myself incorrectly in the title, but my main problem is not that the image exceeds the preview, but that after changing the preview, part of the preview remains It's just when you open the image and then this part stays, it's very distracting. or reason why is happens also that ioctl not impelemented?

sxyazi commented 3 days ago

This is how image rendering works: for displaying, it uses pixel sizes, and for erasing, it uses the font cell size.

The result shown in your image indicates that Yazi correctly handled erasing (in the preview area), but it didn't display correctly (exceeding the preview area) because Windows lacks an API to get the terminal pixel sizes.

So yeah, you just need to manually adjust max_width and max_height so that the pixel size matches the cell size of the preview area.