wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.99k stars 807 forks source link

Kitty image protocol visual glitches when updating placement location #5892

Open evanc577 opened 3 months ago

evanc577 commented 3 months ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

KDE Plasma 6.1.3 (Wayland)

WezTerm version

20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No

Describe the bug

Background

In https://github.com/ncmpcpp/ncmpcpp/pull/437, an ncurses MPD client, I've implemented album artwork via the Kitty terminal graphics protocol. When scrolling ncurses windows, any existing images on screen will also scroll, potentially offscreen. To have the image always exist at a fixed location, I update the image placement back to the desired place after every scroll event by re-transmitting the image ID and placement ID of the displayed image at the desired location.

Graphical glitches

The image remains in the correct location after scrolling, but glitches occur above or below depending on scroll direction.

Wezterm Kitty Konsole
Screenshot_20240802_210203 Screenshot_20240802_210258 Screenshot_20240802_210347

To Reproduce

Unfortunately I don't have a minimal setup.

To reproduce, set up an MPD server with music containing artwork, and use https://github.com/ncmpcpp/ncmpcpp/pull/437 with the following configuration:

albumart = yes
albumart_backend = kitty

startup_screen = artwork
startup_slave_screen = playlist
startup_slave_screen_focus = yes
locked_screen_width_part = 25

Then play a song and scroll a window.

Configuration

no config

Expected Behavior

Image stays in a fixed location during ncurses scroll and doesn't exhibit glitches

Logs

No response

Anything else?

No response

dlugoschvincent commented 3 months ago

I have a similar issue in yazi, but it only happens when I am connected to a unix-domain. Are you in the local domain or in a different domain?

evanc577 commented 3 months ago

I've only tried the default local domain and it happens there.

I have yazi installed but I don't use it. AFAIK, yazi uses the iterm2 image protocol (not kitty protocol) for wezterm but maybe its the same bug. I've briefly investigated the iterm2 protocol before but I didn't think it had support for moving image placements like kitty does.

arodland commented 3 months ago

I tried to do some repro but no luck — after a bunch of work getting deps installed, I find that ncmpcpp crashes with an assertion failure in ImageMagick when I actually visit a track with album art.

Since you have it running, I would suggest running wezterm as WEZTERM_LOG=trace wezterm 2>wezterm.log, triggering the scroll bug within that terminal, exiting, and then inspecting the log, particularly any lines containing image or placement.

evanc577 commented 3 months ago

I tried to do some repro but no luck — after a bunch of work getting deps installed, I find that ncmpcpp crashes with an assertion failure in ImageMagick when I actually visit a track with album art.

Out of curiosity, what is the assertion failure in ncmpcpp that you get?

I'll try to get the log messages later when I have time