equalsraf / neovim-qt

Neovim client library and GUI, in Qt5.
https://github.com/equalsraf/neovim-qt/wiki
ISC License
1.86k stars 171 forks source link

screen flickering when nvim window small #1123

Open tfriedel opened 3 months ago

tfriedel commented 3 months ago

I start neovim in WSL like this:

NVIM_LISTEN_ADDRESS=127.0.0.1:55432 nvim --clean

Then I start nvim-qt:

"C:\Program Files\neovim-qt 0.2.18\bin\nvim-qt.exe" --server 127.0.0.1:55432 

This now mirrors the nvim in wsl. If I resize the terminal showing WSL so it's smaller than the nvim-qt window, the nvim in the terminal is starting to redraw / flicker like crazy. In nvim-qt everything looks stable though.

What's causing this? Similar behaviour I also saw in goneovim but not in neovide.

equalsraf commented 3 months ago

This is probably related to how resizes are handled internally in the GUI vs the terminal UI - my guess is that it enters a loop where the GUI triggers a resize and then the terminal UI resizes it back (... and this continues in a loop). You can also check cpu usage to see if there is a loop going on.

Resize is handled in a few places, and we try to guard against obvious cases, but if the two UIs disagree on what the size should be they can always conflict:

There is a particular corner case - we don't resize when the window is maximized

tfriedel commented 3 months ago

Yes, you are right it's entering a resize loop. Not sure why I wrote that nvim-qt doesn't flicker. When I just tried it, both instances flicker. Also cpu usage goes up.

What could be done about it? Neovide must have solved it somehow.