Skip to content

Commit

Permalink
fix(popupmenu): always show the regular (non-cmdline) popupmenu near …
Browse files Browse the repository at this point in the history
…the cursor
  • Loading branch information
folke committed Jun 6, 2023
1 parent 7b14678 commit e3936cc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lua/noice/ui/popupmenu/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function M.opts(state)
}

local position_auto = not opts.position or opts.position.col == "auto"
if position_auto then
if is_cmdline then
if is_cmdline then
if position_auto then
-- Anchor to the cmdline
local pos = Api.get_cmdline_position()
if pos then
Expand All @@ -100,13 +100,15 @@ function M.opts(state)
opts.anchor = "SW"
end
end
else
opts.relative = { type = "cursor" }
opts.position = {
row = 1,
col = -padding.left,
}
end
else
opts.relative = { type = "cursor" }
local border = vim.tbl_get(opts, "border", "style")
local offset = (border == nil or border == "none") and 0 or 1
opts.position = {
row = 1 + offset,
col = -padding.left,
}
end

-- manage left/right padding on the line
Expand Down

0 comments on commit e3936cc

Please sign in to comment.