Skip to content

Commit

Permalink
fix: anchor popupmenu to SW for bottom cmdline. Fixes #134
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 26, 2022
1 parent c00757c commit 9102aef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions lua/noice/config/views.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ function M.get_options(view)
while opts.view and not done[opts.view] do
done[opts.view] = true

if not Config.options.views[opts.view] then
-- Util.panic("View `" .. opts.view .. "` does not exist?")
end

local view_opts = vim.deepcopy(Config.options.views[opts.view] or {})
opts = vim.tbl_deep_extend("keep", opts, view_opts)
opts.view = view_opts.view
Expand Down
7 changes: 6 additions & 1 deletion lua/noice/ui/popupmenu/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ function M.opts(state)
row = pos.screenpos.row,
col = pos.screenpos.col + state.col - padding.left,
}
if pos.screenpos.row == vim.go.lines then
opts.position.row = opts.position.row - 1
opts.anchor = "SW"
end
end
else
opts.relative = { type = "cursor" }
Expand All @@ -123,6 +127,7 @@ end

---@param state Popupmenu
function M.show(state)
M.on_hide()
local is_cmdline = state.grid == -1
local opts, padding = M.opts(state)

Expand All @@ -143,7 +148,7 @@ function M.show(state)
end
end

for i, item in ipairs(state.items) do
for _, item in ipairs(state.items) do
if type(item) == "string" then
item = { word = item }
end
Expand Down

0 comments on commit 9102aef

Please sign in to comment.