-
Notifications
You must be signed in to change notification settings - Fork 489
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
[Feature Request] inner-padding around nvim #140
Comments
Correct me if I'm wrong, but this feels like a feature that should be enabled in your window manager, not the app |
I don't think it should be the prerogative of the gui to add padding around windows when all other situations that is undesirable. |
This is what I'm talking about. I don't see other apps really adding options for inner padding, and I'm concerned about the added complexity for such a niche feature. |
Ho ok, sorry about that, I though you think about window borders. Well, most of the terminal I used have this options (vte-based, urxvt.. ) so I'm used to it. But you probably right, not a lot of people will need it. I'll see if I can trick my vm. Thank's for your time ! :) |
Window border handling is currently all managed by the windowing system which is currently managed by winit, but moving to sdl2 since winit appears to be buggy in a few crucial ways. I'm actually going to reopen this as a future enhancement, but at the moment it is going to be very low priority :( If done in an unobtrusive way I would be happy to take a pull request, but I'd probably be pretty picky about much added complexity since its just a few of us managing the project :) |
I did a quick experiment, and submitted my WIP to this branch: https://github.com/Kethku/neovide/tree/window-margin-experiment This is how it looks right now on Linux (Sway window manager), with a huge black margin: Issues I've found:
|
I'm going to close this as out of scope. I think this adds too much complexity for a niche use case |
@jonvaldes I tried to do the same based on your fork with the little changes and got pretty nice results. No glitches, margin have proper background color, pointer positioning is absolutely OK, mouse position is handled correctly and it feels like complexity of the code is almost not increased. I'm new to Rust, I will refactor my code a bit later and try to prepare a good PR for review. |
Gui's on macOS (and I assume windows) can't take advantage of padding through the WM/compositor, since yabai etc. doesn't support it. I understand its outside the scope of neovim, but could you kindly reconsider opening the issue? |
Done. However I think its pretty low priority unless somebody wants to take it on. |
@zezic do you mind sharing your WIP code? |
@shaunsingh It seems like I deleted it from my disk. It was mostly based on this commit: c376629 |
No problem. Alacritty has a similar option so I'll take a look at both. |
@Kethku Could you help guide an implementation of this feature? At the moment I've written some code that changes the size of the rendered image on the canvas, instead of changing the grid width/height. Is that the right approach? My intention is to allow for pixel values to represent window padding, but I'm not sure what else needs to be adjusted with those padding values. I have attempted to configure the CursorRender with the padding values, but I'm wondering if it would be better to adjust the GridRenderer instead? Any thoughts? |
In the end, padding is "just" shrinking the character grid. So the cursor renderer has nothing to do with that. Changing the actual rendered size though sounds... a bit interesting. Do you scale down from the original image or do you just provide whole other sizes from the start on? |
In one of my first attempts I tried decreasing the CharacterGrid and shifting it with the grid position, but it seemed to truncate the content. For example, my status bar at the bottom right would be clipped if I decreased the grid width. Though I'm curious if that is the best way to shrink the grid. For my second attempt I tried rendering all the content with no changes to the size of the character grid, but I changed the surface image dimensions and the pixel region. This cleanly moves things into view with the padding (no truncating) but it confuses the CursorRenderer. I think the CursorRenderer uses the font-width and grid size to figure out where it should be, but changing the image size seems to implicitly change the font-width of the image, which means I have to explain to the CursorRenderer how to handle the padding sizes. But this doesn't seem to be a simple solution because many things rely on the font dimensions and grid size. Ideally I would be able to simply decrease the character grid width without the weird truncating stuff. But I'm not sure how to do this, any ideas? |
Will read this sometime today and respond with thoughts. Thanks for the ping! |
Okay I have an update: For more context here's a working version of the code pushed up to a branch: Maybe somebody who understands the scrolling logic and the changes I made can help point me in the right direction. Let me know what ya'll think when you have a chance. Thank you! |
Okay I took a step back to solve this without squishing the image. I was noticing too many glitches that would result from too much padding. So I went through the code again and found a simpler solution by finding the best location to reduce the size of the character grid. This results in no truncating of content and no weird re-calculations of the CursorRenderer & stuff. Here's a new commit with the basics of what I have: @MultisampledNight I can see now what you meant about not needing to tweak the CursorRenderer, this approach fits much better with all the existing pieces. Thanks for your input! 🙏 |
@seanstrom So? It looks very nice, how do we get it? |
@i-am-the-slime at the moment it’s here: https://github.com/seanstrom/neovide/tree/feature-window-padding-V2 If you pull down my fork of neovide with that branch you can build it from source. Though it should likely be updated with the latest commits from the official main branch. Happy to put together a PR if the maintainers are interested too. |
Please do! This is great. |
Thanks @MultisampledNight 😸 Here’s a link to the pull request for anyone interested: #1632 |
Good news, the branch implementing window padding support was recently merged into main 🙌 |
How to set window padding? through neovim config? any guide? |
...I seriously still haven't managed to do the docs on this. You need to be running on git main, and you can set the variables |
I have mine configured with VimScript like this:
Which I think in Lua would be this:
|
Thanks. |
Are you saying that the tabline is not padded? Or that the color of the padding is incorrect? my assumption was that the padding was transparent, but maybe it uses the background color of the theme 🤔 |
no, padded works just perfect, but the color is same to
|
I’m trying to understand the screenshots related to the color. In your example are you saying the padding is colored black or gray? For the second issue related to the bottom padding glitch, are you saying that happens when you set the And in general are you configuring the padding and cmdline settings dynamically by typing it in the command line or by setting the values in a config file? |
I wish it was black(same as my tabline's bg), but it's gray(same as
I only set the
it is in my config file |
Okay I’ll try understanding how the color is assigned for the padding and think about how to change that. Not sure how that works at the moment, so that might take a while before I come up with a solution. Hope that’s okay 🙏 About the extra spacing at the bottom, I’m not sure what that is, but it could be related to how Neovim is being resized into the window. It seems Neovide is allowing up to one block of padding to be appended at the bottom. The block of padding is sized from 0 to your font height. You can test this out by increasing the font in Neovide and noticing the extra padding correlates to the font size. I think that extra padding issue is related to how Neovim is being sized and rendered inside the window. I’ll try taking a look but I’m not sure how to solve that either. I know it has something to do with character grids and stuff, and it seems we have extra space unused by the character grid. |
appreciate for that! |
btw, I don't know if this feature request is useful but might relate to neovide's ui setting. It would be very cool if the inner-padding could be combined with a transparent specific component, but now neovide only support transparent globally. |
It can be nice to be able to set padding aroud nvim instance.
Here is an exemple with vim on my terminal on the right.
The text was updated successfully, but these errors were encountered: