Skip to content

Commit

Permalink
fix(win): dont center float when relative="cursor"
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 7, 2024
1 parent 107d10b commit 4991e34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/snacks/win.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ function M:win_opts()
opts.height = math.floor(opts.height < 1 and parent.height * opts.height or opts.height)
opts.width = math.floor(opts.width < 1 and parent.width * opts.width or opts.width)

if opts.relative == "cursor" then
return opts
end
opts.row = opts.row or math.floor((parent.height - opts.height) / 2)
opts.col = opts.col or math.floor((parent.width - opts.width) / 2)
return opts
Expand Down

0 comments on commit 4991e34

Please sign in to comment.