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
feat: persist grid size along with window size #2127
Conversation
Hm... I need to check a bit more what's going on here, since the window should not be visible until the actual size is determined after the changes I did here, and some additional fixes after that. It was briefly broken, but should have been fixed again here #2120, unless the fix does not properly work. The window should never be visible with the wrong physical size unless you set Finally, I don't think saving the columns along with the window size is a good solution, since they can conflict with each other, for example if the guifont or padding has been changed since the options have been changed. But maybe it could work if the saved grid size is just used as an initial hint. |
@fredizzimo the physical size of the window is fine on startup, but the initial grid size is just the default, which causes the problems I described. It also looks bad with the statusbar and tabline not being the correct size until the subsequent resize/redraw, so it's not just Another thought I just had is maybe we can calculate the correct grid size from the physical window size before doing |
Unfortunately that's impossible, we need |
Indeed, that's what I just found out after trying to go down that path and get So then the dilemma is that
Any thoughts? If you have some ideas I'd be happy to explore them. I've only worked in the neovide codebase since last week, so there's a lot I've yet to familiarize myself with. |
I think we can only do 1. And I think this PR does almost that, but it can only affect the grid size given to
I tried to delay the showing of the window until UIEnter is called or an error message is shown. I think that would work much better, and Neovim would respond to the resize request almost immediately. But plugins like |
Is there anything else you'd like me to try or change, or are you still experimenting with the delayed rendering? |
I think it looks good as it is. Upon further inspection it looks like it only affects the initial grid size as it should, so once the compilation problem is fixed it should be ok. |
@fredizzimo should be good to go now. |
I will wait with the merging until tomorrow, in case I think of a better idea. but it looks good. |
Thanks! This is good enough for now, and hopefully we can find an even better solution in the future, maybe with some extra functionality from Neovim. |
I hope so! I'm not a fan of hacky workarounds, but I didn't see a clean solution for this. |
What kind of change does this PR introduce?
Did this PR introduce a breaking change?
When neovide starts up, it uses a default grid size unless the grid size has explicitly been provided. This is problematic when relying on neovide to remember the last window size, because the grid size will be out of sync with the physical window size. The UI will initially be rendered at the wrong size, which not only doesn't look great, but exposes some other issues like the noice mini view not handling resizes properly. So if a noice mini view is rendered immediately upon startup, and neovide resizes the grid, the mini view will stay in place until it times out and disappears. In my case it stays in the middle of the screen until the 5 second timeout passes, which is quite annoying.
I thought about playing with not making the window visible until the first resize had been handled, but that wouldn't solve the problem of plugins not handling resizes properly, and it would also slow down the time until window is first shown. It didn't seem worth going down that path.
I decided to not introduce another setting flag since I think it makes sense to save the physical window size and the grid size together. The saved grid size would be incorrect if the font dimensions change between neovide launches, but most people probably won't change to very different font dimensions between launches. Even if that happens, the saved grid size will probably be more reasonable than the default, and if it's not it will be resized immediately if needed, so it's no worse than the current situation.