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

More floating window rendering issues #2502

Open
sid-6581 opened this issue Apr 24, 2024 · 3 comments
Open

More floating window rendering issues #2502

sid-6581 opened this issue Apr 24, 2024 · 3 comments
Labels
bug Something isn't working multigrid Related to the multigrid extension

Comments

@sid-6581
Copy link
Contributor

sid-6581 commented Apr 24, 2024

In mini.files the help window is transparent (edit: it's only transparent with respect to the underlying float, not the main buffer):

image

In neo-tree the preview window isn't transparent, but the contents are off by one, where the first line is rendered one line too high, and the bottom content line is blank:

image

Desktop (please complete the following information):

  • OS: Windows 11
  • Neovide Version: Latest commit
  • Neovim Version: Nightly
@sid-6581 sid-6581 added the bug Something isn't working label Apr 24, 2024
@fredizzimo
Copy link
Member

I'm commenting on the first issue first, and will investigate the second one next.
The windows have z-index 99 and 100 respectively, and with:

There are basically two options, I think.

  1. Standardize that consecutive z-indices are special around the whole nvim echo system. The issue can be fixed by using z-index 100 and 102 for example.
  2. Properly experiment, if we actually need to combine different layers, or if it's enough to use a single layer while still maintaining compatibility with the terminal mode rendering. This probably also requires some adaptation on the plugin side, but if it works, I think it's a much nicer option than number 1.

@Kethku

@fredizzimo
Copy link
Member

For the second issue, I'm not 100% sure yet, but almost. The preview window consists of two subwindows, the first one has this anchor

TRACE [neovide::channel_utils] neovim_handler WindowFloatPosition { grid: 10, anchor: NorthWest, anchor_grid: 1, anchor_row: -1.0, anchor_column: 40.0, focusable: false, sort_order: Some(39) }

While the second one has this:

TRACE [neovide::channel_utils] neovim_handler WindowFloatPosition { grid: 11, anchor: NorthWest, anchor_grid: 10, anchor_row: 1.0, anchor_column: 1.0, focusable: true, sort_order: Some(40) }

So, the second one is attached to the first one, but the first one is actually anchored outside the screen. Neovim does not reposition floats that are outside the grid, so we are forced to do it ourselves:

But I think our code is a bit too naive and only consider each window individually. Therefore, it only re-positions the outer window with the borders, leaving the inner one in place, which means that they start to overlap. I think we just need to consider all the attached floating windows as a whole group and reposition it as a whole.

@sid-6581
Copy link
Contributor Author

@fredizzimo after looking at it some more, I think the second issue may be a nui bug. neo-tree is requesting a popup with row 0, and then nui adjusts it to -1 here:

https://github.com/MunifTanjim/nui.nvim/blob/cbd2668414331c10039278f558630ed19b93e69b/lua/nui/popup/border.lua#L342-L347

I'm honestly not sure if this is something neovim should do something about when multigrid is enabled? It does appear to clamp the values in the terminal, so it is technically inconsistent, but I'm not sure if the way neovim/neovide handles it now is really wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multigrid Related to the multigrid extension
Projects
None yet
Development

No branches or pull requests

2 participants