mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(win): col/row can be negative calculated on height/end of parent
This commit is contained in:
parent
003ea8d6ed
commit
bd49d2f32e
1 changed files with 2 additions and 0 deletions
|
@ -612,6 +612,8 @@ function M:win_opts()
|
|||
return opts
|
||||
end
|
||||
local border_offset = self:has_border() and 2 or 0
|
||||
opts.row = opts.row and opts.row < 0 and parent.height + opts.row - opts.height + 1 or opts.row
|
||||
opts.col = opts.col and opts.col < 0 and parent.width + opts.col - opts.width + 1 or opts.col
|
||||
opts.row = opts.row or math.floor((parent.height - opts.height - border_offset) / 2)
|
||||
opts.col = opts.col or math.floor((parent.width - opts.width - border_offset) / 2)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue