Skip to content

Commit

Permalink
fix(popup): don't make the window column go below negative 1 (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-programs authored Mar 24, 2024
1 parent da01137 commit 01b2b53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/noice/message/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Message:focus()
if win then
vim.api.nvim_set_current_win(win)
-- switch to normal mode
vim.cmd("stopinsert")
vim.cmd("stopinsert")
return true
end
end
Expand Down
5 changes: 5 additions & 0 deletions lua/noice/ui/popupmenu/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ function M.opts(state)
row = pos.screenpos.row,
col = pos.screenpos.col + state.col - padding.left,
}
-- the padding might get the window below 0
if opts.position.col < 0 then
opts.position.col = 0
end

if pos.screenpos.row == vim.go.lines then
opts.position.row = opts.position.row - 1
opts.anchor = "SW"
Expand Down

0 comments on commit 01b2b53

Please sign in to comment.