zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
22.08k stars 674 forks source link

Corrupted/lost text when scrolling in vertically split neovim window using wezterm with `wezterm` TERM enviornment variable #3412

Open CarbonChauvinist opened 5 months ago

CarbonChauvinist commented 5 months ago

1. Graphical issue inside a terminal pane (eg. something does not look as it should)

Please attach the files that were created in /tmp/zellij-1000/zellij-log/ to the extent you are comfortable with.

zellij-12.log zellij.log

Basic information

zellij --version: zellij 0.41.0

stty size: 32 145

uname -av: Linux lap 6.9.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 x86_64 GNU/Linux

Further information

After further testing using the terminals I use this only occurs with Wezterm when run with wezterm TERM enviornment variable. This may be a Wezterm issue?

Wezterm version: wezterm 20240203-110809-5046fc22

The terminals I tested where the issue did not present itself: (terminal/TERM)

Verified this issue is present on the latest build of zellij (using zellij-git package from aur). Currently using the development version of neovim (NVIM v0.11.0-dev-199+g4881211097).

When opening neovim and creating a vertical split on any file within neovim, scroll down in one window within neovim and observe that the other split window begins to scroll as well and then eventually becomes garbled and loses text. One can switch back and forth between windows and scroll up and down and observe the same behavior on the opposite window from the one currently being scrolled.

To reproduce:

  1. run wezterm with term set to wezterm in config
  2. run zellij with default settings.
  3. run development version of neovim also in a clean state with no plugins loaded (i.e. nvim --clean -u NONE -i NONE)
  4. Open any file
  5. create a vertical split
  6. Scroll down in the current window and observe the reported issue in the neighboring window within neovim

Attached a short screen capture of the behavior for reference.

Also note, in Wezterm with wezterm TERM env this issue does not present itself when running latest version of vim available in the standard Arch repos, nor does it present itself when running neovim without zellij.

May be related to issue #263

edit: uploaded new video file as original may have been corrupted somehow

https://github.com/zellij-org/zellij/assets/21365869/c4114f1f-5138-463d-85f7-bc5106d71ca7

mike-lloyd03 commented 5 months ago

I'm having this problem as well and it only happens inside Zellij and nvim. However, when downgrading to 0.40.0, it's still happening.

I think this relates to nvim 0.10.0. Downgrading to nvim 0.9.5 and Zellij 0.40.0 fixes the problem for me.

nvim 0.10.0 and Zellij 0.40.1: visual artifacts confirmed nvim 0.9.5 and Zellij 0.40.1: visual artifacts confirmed nvim 0.10.0 and Zellij 0.40.0: visual artifacts confirmed nvim 0.9.5 and Zellij 0.40.0: no visual artifacts

mike-lloyd03 commented 5 months ago

I take it back. This appears to be happening in nvim 0.9.5 and Zellij 0.40.0. I'm noticing it in Wezterm and Kitty.

mike-lloyd03 commented 5 months ago

Okay I did some more testing. It looks like this is limited to Zellij 0.40.1. If I downgrade to 0.40.0 and delete-all-sessions, the problem disappears.

mrdgo commented 5 months ago

Have you guys tried scrolling with Ctrl-u and Ctrl-d? Probably boils down to the same bug but it looks even worse. Please confirm, otherwise I'll open a separate issue. Edit: I can't deterministically reproduce it. Sometimes, only the line with the cursor in it scrolls with the rest staying as is or even getting partially broken.

Currently, you can fix it by hitting Ctrl-z.

CarbonChauvinist commented 5 months ago

@mrdgo Yes <C-u> and <C-d> present the same behavior. The behavior of the corrupted nvim window is never really consistent, but I can always reproduce the issue. Again, it only occurs with wezterm and when I've set the wezterm terminfo. (Maybe it's a wezterm issue related to their custom terminfo and not a zellij issue?)

I've attached another screen grab which shows this in action - apologies for some of the artifacts/compression that's not related to the issue at hand but rather the screen recording itself. In this I scroll down first line by line (i.e. j and k) and then by page (i..e. <C-d> and <C-u>) in the unaffected nvim window. I then switch the affected nvim window and do the same, scroll by line and then by page. I also jump between beginning and end of buffer with gg and G.

https://github.com/zellij-org/zellij/assets/21365869/2668cba7-60f5-476c-a81d-b91f12e65aae

Not sure what you mean by <C-z> fixing the issue - what is that? Is that bound to something in your zellij config?