Skip to content

Commit

Permalink
fix(fzf): add vertical offset for complex window borders
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy committed Jan 25, 2024
1 parent 51c3647 commit 66b9661
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down

0 comments on commit 66b9661

Please sign in to comment.