From 66b966180bc8ac43c37df3131d32e5fa657a03df Mon Sep 17 00:00:00 2001 From: Will Hopkins Date: Tue, 23 Jan 2024 03:05:15 -0800 Subject: [PATCH] fix(fzf): add vertical offset for complex window borders --- lua/dropbar/menu.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/dropbar/menu.lua b/lua/dropbar/menu.lua index 940c643f..fae38792 100644 --- a/lua/dropbar/menu.lua +++ b/lua/dropbar/menu.lua @@ -942,7 +942,7 @@ function dropbar_menu_t:fuzzy_find_open(opts) end local win_config = - vim.tbl_extend('force', self._win_configs, opts.win_configs or {}, { + vim.tbl_extend('force', self.win_configs, opts.win_configs or {}, { relative = 'win', win = self.win, anchor = 'NW', @@ -952,6 +952,29 @@ function dropbar_menu_t:fuzzy_find_open(opts) row = self._win_configs.height + (menu_has_bottom_border and 1 or 0), }) + for k, v in pairs(win_config) do + if type(v) == 'function' then + win_config[k] = v(self) + end + end + + if type(win_config.border) == 'table' then + if #win_config.border > 4 then + win_config.border[2] = '' -- top + elseif #win_config.border > 1 then + win_config.border[1] = '' + elseif #win_config.border == 1 then + local ch = win_config.border[1] + for i = 1, 8 do + if i == 2 then + win_config.border[i] = '' + else + win_config.border[i] = ch + end + end + end + end + -- don't show title in the fzf window win_config.title = nil win_config.title_pos = nil