-
Notifications
You must be signed in to change notification settings - Fork 17
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: optionally position scrollbar over menu #96
Conversation
146c7da
to
6ee526f
Compare
86405e2
to
d42a135
Compare
6ee526f
to
043fb61
Compare
Rebased on top of master and updated docs :) |
Hi, thanks for this PR. We could achieve further customizability by allowing user to control the window configurations of the scrollbar and enable/disable the scrollbar thumb and the background separately, like this: local opts = {
menu = {
scrollbar = {
enable = true,
sbar = {
enable = true,
---@alias dropbar_menu_win_config_opts_t any|fun(menu: dropbar_menu_t):any
---@type table<string, dropbar_menu_win_config_opts_t>
---@see vim.api.nvim_open_win
win_conifgs = {
}
},
thumb = {
enable = true,
---@type table<string, dropbar_menu_win_config_opts_t>
win_conifgs = {
}
}
}
}
}
} |
That's a good idea, I'll make those changes tomorrow! |
My bad, some things came up and I didn't have time to get to this, but I should have some time in the next few days :) |
@willothy Sure, please take your time, we are not in a hurry! Thanks for the great PRs you've made along the way. I can give you push permission if that is more convenient for you. |
@Bekaboo sure, that'd be cool! Thanks for trusting me with that :) I'll still wait for reviews before merging anything of course. |
I have sent you an invitation. |
Thanks, sounds good! |
Working on this right now - I think it would be cool to be able to disable the bar and thumb separately, but I'm not sure I see a point in allowing users to customize I think something like this is probably enough, and more properties could be added individually (maybe scrollbar = {
enabled = true,
-- The background / gutter of the scrollbar (optional)
sbar = {
-- When false, only the thumb is shown.
enabled = true,
},
}, |
f37b365
to
2a9b8bd
Compare
This makes sense, to reduce the complexity we can only make the border configurable. However we can still have the Also, the There is an existing bug -- when a dropbar menu has border, the scrollbar and scroll menu will be covered by the border. To fix the issue we have to set a different z index for the scrollbar such that it is above the menu but it should be covered by the sub-menus, e.g. if the first menu has |
I think the reason why nvim-cmp's scrollbar has no background is simply that the background has the same EDIT:
To avoid complexity the |
Nice, that looks really cool! I may have to start using a border in my config...
I agree with the enable field just being a boolean, I think the border logic you just added is all that's needed since that's probably what people would use a callback for. If more customization is needed, a callback would be easy to add in the future anyways.
That sounds good. Should the border be allowed on the background as well, or just on the thumb? There may be some edge cases to handle to ensure that scrollbar borders don't overlap with submenus. |
After some reflection, I realized that no one has really requested to customize the scrollbar border, and only allowing scrollbar = {
enabled = true,
-- The background / gutter of the scrollbar (optional)
sbar = {
enabled = true, -- should we remove this too? it is still needed if you want to remove the background when menu border is 'none'
},
}, |
Yeah, that's good with me, makes things a lot simpler. I wouldn't be using the border, so no worries. Not sure why I had that idea lol.
I do want to still be able to remove the background when there's no border though, I think that's an important customization (or one that I'll use, at least haha). Maybe it can just be a single boolean, like |
Agreed. I suggest the following structure: menu = {
scrollbar = {
enable = true,
background = true
}
} |
Sounds good! I'll update and fix the conflicts tomorrow. |
2a9b8bd
to
ea1f96b
Compare
Should be all good now |
@willothy Thanks for the PR, looks great! A few small suggestions:
|
Adds the ability to hide the scrollbar's background, or to disable it entirely.
ea1f96b
to
034efbe
Compare
Done
Added vimdoc and updated the scrollbar docs in readme with the new names.
Not sure, but I removed it because it's not needed now lol
No worries! Should be done as well. |
I prefer a floating scrollbar like I had originally implemented - this adds a "floating" option to use no background window, and an option to disable the scrollbar entirely. The current behavior is still the default.