Skip to content

Commit

Permalink
fix(menu-scrollbar): scrollbar thumb covered by menu border
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Dec 3, 2023
1 parent f54d926 commit 2b7c2d5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ https://github.com/Bekaboo/dropbar.nvim/assets/76579810/e8c1ac26-0321-4762-9975-
end, menu.entries)))
)
end,
zindex = function(menu)
if menu.prev_menu then
if menu.prev_menu.scrollbar and menu.prev_menu.scrollbar.thumb then
return vim.api.nvim_win_get_config(menu.prev_menu.scrollbar.thumb).zindex
end
return vim.api.nvim_win_get_config(menu.prev_win).zindex
end
end,
},
},
fzf = {
Expand Down Expand Up @@ -1176,6 +1184,14 @@ menu:
end, menu.entries)))
)
end,
zindex = function(menu)
if menu.prev_menu then
if menu.prev_menu.scrollbar and menu.prev_menu.scrollbar.thumb then
return vim.api.nvim_win_get_config(menu.prev_menu.scrollbar.thumb).zindex
end
return vim.api.nvim_win_get_config(menu.prev_win).zindex
end
end,
}
```

Expand Down
8 changes: 8 additions & 0 deletions doc/dropbar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,14 @@ the menu:
end, menu.entries)))
)
end,
zindex = function(menu)
if menu.prev_menu then
if menu.prev_menu.scrollbar and menu.prev_menu.scrollbar.thumb then
return vim.api.nvim_win_get_config(menu.prev_menu.scrollbar.thumb).zindex
end
return vim.api.nvim_win_get_config(menu.prev_win).zindex
end
end,
}
<

Expand Down
8 changes: 8 additions & 0 deletions lua/dropbar/configs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ M.opts = {
end, menu.entries)))
)
end,
zindex = function(menu)
if menu.prev_menu then
if menu.prev_menu.scrollbar and menu.prev_menu.scrollbar.thumb then
return vim.api.nvim_win_get_config(menu.prev_menu.scrollbar.thumb).zindex
end
return vim.api.nvim_win_get_config(menu.prev_win).zindex
end
end,
},
},
fzf = {
Expand Down
18 changes: 10 additions & 8 deletions lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -566,32 +566,34 @@ function dropbar_menu_t:update_scrollbar()
else
self:close_scrollbar()
self.scrollbar = {}

local win_configs = {
row = offset,
row = 0,
col = menu_win_configs.width,
width = 1,
height = thumb_height,
height = menu_win_configs.height,
style = 'minimal',
border = 'none',
relative = 'win',
win = self.win,
zindex = menu_win_configs.zindex,
}
self.scrollbar.thumb = vim.api.nvim_open_win(
self.scrollbar.sbar = vim.api.nvim_open_win(
vim.api.nvim_create_buf(false, true),
false,
win_configs
)
vim.wo[self.scrollbar.thumb].winhl = 'NormalFloat:DropBarMenuThumb'
vim.wo[self.scrollbar.sbar].winhl = 'NormalFloat:DropBarMenuSbar'

win_configs.row = 0
win_configs.height = menu_win_configs.height
self.scrollbar.sbar = vim.api.nvim_open_win(
win_configs.row = offset
win_configs.height = thumb_height
win_configs.zindex = menu_win_configs.zindex + 1
self.scrollbar.thumb = vim.api.nvim_open_win(
vim.api.nvim_create_buf(false, true),
false,
win_configs
)
vim.wo[self.scrollbar.sbar].winhl = 'NormalFloat:DropBarMenuSbar'
vim.wo[self.scrollbar.thumb].winhl = 'NormalFloat:DropBarMenuThumb'
end
end

Expand Down

0 comments on commit 2b7c2d5

Please sign in to comment.