Skip to content

Commit

Permalink
fix(utils): menu: ui.select menu has thick bottom border
Browse files Browse the repository at this point in the history
Bug:    `ui.select` menu has improper thick bottom border when
        header/prompt is given and `opts.menu.win_configs.border` is
        configured as `{ '', '', '', '' }` (table with 4 elements)
Fix:    This is because we set the `border[2]` to ' ' (space).
        so that we have a thick upper border to show the header but
        the thick border is repeated as the bottom border when then
        the border table has only 4 elements, see `:h nvim_open_win`.
        To fix this issue, expand the border table to 8 elements
        and set the `border[2]` to space.
  • Loading branch information
bekaboo committed Feb 5, 2024
1 parent e4fd982 commit c3de6fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/dropbar/utils/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ function M.select(items, opts, on_choice)
win_configs.border = border_none_with_prompt
fzf_win_configs.border = 'none'
elseif #border > 1 and border[2] == '' then
local border_cp = vim.deepcopy(border)
border_cp[2] = ' '
win_configs.border = border_cp
win_configs.border = vim.deepcopy(border)
if #win_configs.border == 4 then
vim.list_extend(win_configs.border, win_configs.border)
end
win_configs.border[2] = ' '
-- use the original headerless border for fzf
fzf_win_configs.border = border
end
Expand Down

0 comments on commit c3de6fe

Please sign in to comment.