Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(menu): allow relative win settings other than win #90

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ function dropbar_menu_t:eval_win_configs()
self._win_configs[k] = config
end
end

if self._win_configs.relative ~= 'win' then
self._win_configs.win = nil
end
end

---Get the component at the given position in the dropbar menu
Expand Down Expand Up @@ -888,15 +892,20 @@ function dropbar_menu_t:fuzzy_find_open(opts)
col_offset = 1
end

local win = vim.api.nvim_open_win(
buf,
false,
local win_config =
vim.tbl_extend('force', self._win_configs, opts.win_configs or {}, {
row = self._win_configs.row + self._win_configs.height,
col = self._win_configs.col - col_offset,
relative = 'win',
win = self.win,
row = self._win_configs.height,
col = col_offset,
height = 1,
})
)

-- don't show title in the fzf window
win_config.title = nil
win_config.title_pos = nil

local win = vim.api.nvim_open_win(buf, false, win_config)
vim.wo[win].stc = opts.prompt
_G.dropbar.menus[win] = self
self.fzf_state = utils.fzf.fzf_state_t:new(self, win, opts)
Expand Down