Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'termsync' : cursor rendering issue on zellij with floating window #29427

Closed
pierregoutheraud opened this issue Jun 20, 2024 · 8 comments
Closed
Labels
bug issues reporting wrong behavior tui
Milestone

Comments

@pierregoutheraud
Copy link

pierregoutheraud commented Jun 20, 2024

Problem

Hello,

I started using zellij instead of tmux recently and I noticed an annoying bug with zellij, the cursor flickering/incorrectly rendering when using any kind of floating window: there is sometimes 1 frame where the cursor is rendered somewhere else in the terminal or completely gone while the window is being rendered.

I posted a comment on zellij github (zellij-org/zellij#3208 (comment)) and the main contributor/creator is telling me that "This issue is 99% a misimplementation of CSI 2026 (synchronized renders) by ... nvim".

Is this the case?

Screen.Recording.2024-06-20.at.10.18.40.mov

Steps to reproduce

  1. zellij
  2. nvim --clean -u minimal.lua
  3. Then try spamming the f key, you should see the cursor blinking.

I am using nvim 0.10.0 and zellij 0.40.1.
This is reproducible on Kitty 0.35.1, Alacritty 0.13.2 and Wezterm.

minimal.lua:

function open_floating_window()
  -- Get the current buffer handle
  local buf = vim.api.nvim_create_buf(false, true)

  -- Define the window options
  local opts = {
    relative = "editor",
    width = math.floor(vim.o.columns * 0.8),
    height = math.floor(vim.o.lines * 0.8),
    col = math.floor(vim.o.columns * 0.1),
    row = math.floor(vim.o.lines * 0.1),
    anchor = "NW",
    style = "minimal",
  }
  
  -- Create the window
  vim.api.nvim_open_win(buf, true, opts)
end

-- Open the window with "f" key in normal mode
vim.api.nvim_set_keymap(
  "n",
  "f",
  ":lua open_floating_window()<CR>",
  { noremap = true, silent = true }
)

Expected behavior

On zellij, the cursor should not blink and its position should always be at the start of the floating window.

Neovim version (nvim -v)

0.10.0

Vim (not Nvim) behaves the same?

Could not test floating window in vim

Operating system/version

macOS 14.3.1

Terminal name/version

Kitty 0.35.1, Alacritty 0.13.2

$TERM environment variable

xterm-kitty

Installation

homebrew

@pierregoutheraud pierregoutheraud added the bug issues reporting wrong behavior label Jun 20, 2024
@zeertzjq zeertzjq added the tui label Jun 20, 2024
@justinmk justinmk changed the title Cursor rendering issue on zellij with floating window 'termsync' : cursor rendering issue on zellij with floating window Jun 20, 2024
@justinmk
Copy link
Member

justinmk commented Jun 20, 2024

"This issue is 99% a misimplementation of CSI 2026 (synchronized renders) by ... nvim".

Does the issue occur if you disable 'termsync'?

For reference:

@justinmk justinmk added this to the backlog milestone Jun 20, 2024
@pierregoutheraud
Copy link
Author

@justinmk Yes, the issue still occurs but is less obvious as the cursor only flickers but stays at the same position.
With tmux or without multiplexer it does not blink/flickers.

Screen.Recording.2024-06-20.at.18.24.32.mov

This doesn't sound like a huge deal but it becomes quite annoying when you have a bunch of plugins, opening a bunch of windows as you are typing (For example autocompletion windows etc.).

@gpanders
Copy link
Member

I posted a comment on zellij github (zellij-org/zellij#3208 (comment)) and the main contributor/creator is telling me that "This issue is 99% a misimplementation of CSI 2026 (synchronized renders) by ... nvim".

From your linked issue:

Hey, for the record: I looked at the dump and the CSI 2026 appears at the beginning and end properly (this is a dump of the whole terminal state, not just one frame - indeed the CSI 2026 serves as the definition of the frame start and end).

@pierregoutheraud
Copy link
Author

@gpanders I was referring to one of his previous comment:

Thanks to everyone for pointing out their reproductions and experiences here, but at this point I don't think this adds anything to the discussion. This issue is 99% a misimplementation of CSI 2026 (synchronized renders) by either noice or nvim (as demonstrated by shutting them down mitigating this issue).

Are you by any chance reproducing this weird behaviour?

@clason
Copy link
Member

clason commented Jun 20, 2024

Well, it would help to have a reproduction without noice. We take standards compliance very seriously.

@gpanders
Copy link
Member

@gpanders I was referring to one of his previous comment

Yes, but I was pointing out that later in the same thread the Zellij maintainer seems to have absolved Neovim by pointing out that our implementation is correct.

@pierregoutheraud
Copy link
Author

@gpanders I see! Indeed he is not reproducing on this config when cating my ANSI dump.
@clason I posted a minimal.lua file in my first message, this is without any plugins.

@gpanders
Copy link
Member

Resolved in Zellij zellij-org/zellij#3208 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior tui
Projects
None yet
Development

No branches or pull requests

5 participants