Skip to content

Commit e3936cc

Browse files
committed
fix(popupmenu): always show the regular (non-cmdline) popupmenu near the cursor
1 parent 7b14678 commit e3936cc

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lua/noice/ui/popupmenu/nui.lua

+10-8
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function M.opts(state)
8585
}
8686

8787
local position_auto = not opts.position or opts.position.col == "auto"
88-
if position_auto then
89-
if is_cmdline then
88+
if is_cmdline then
89+
if position_auto then
9090
-- Anchor to the cmdline
9191
local pos = Api.get_cmdline_position()
9292
if pos then
@@ -100,13 +100,15 @@ function M.opts(state)
100100
opts.anchor = "SW"
101101
end
102102
end
103-
else
104-
opts.relative = { type = "cursor" }
105-
opts.position = {
106-
row = 1,
107-
col = -padding.left,
108-
}
109103
end
104+
else
105+
opts.relative = { type = "cursor" }
106+
local border = vim.tbl_get(opts, "border", "style")
107+
local offset = (border == nil or border == "none") and 0 or 1
108+
opts.position = {
109+
row = 1 + offset,
110+
col = -padding.left,
111+
}
110112
end
111113

112114
-- manage left/right padding on the line

0 commit comments

Comments
 (0)