From c3de6fee0dbd836568cbacb0f7ce7b312ca03f27 Mon Sep 17 00:00:00 2001 From: bekaboo <18127878294@qq.com> Date: Tue, 6 Feb 2024 02:22:23 +0800 Subject: [PATCH] fix(utils): menu: `ui.select` menu has thick bottom border 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. --- lua/dropbar/utils/menu.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/dropbar/utils/menu.lua b/lua/dropbar/utils/menu.lua index 35ee0ee6..31a4e35b 100644 --- a/lua/dropbar/utils/menu.lua +++ b/lua/dropbar/utils/menu.lua @@ -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