Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lua/which-key/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local dw = vim.fn.strdisplaywidth
--- Otherwise, it is a percentage of `parent` (relative size).
--- If `size` is negative, it is subtracted from `parent`.
--- If `size` is a table, it is a range of values.
---@alias wk.Dim number|{min:number, max:number}
---@alias wk.Dim number|{min:number, max:number}|function

---@param size number
---@param parent number
Expand All @@ -17,6 +17,9 @@ function M.dim(size, parent, ...)
size = math.abs(size) < 1 and parent * size or size
size = size < 0 and parent + size or size
for _, dim in ipairs({ ... } --[[ @as wk.Dim[] ]]) do
if type(dim) == "function" then
dim = dim()
end
if type(dim) == "number" then
size = M.dim(dim, parent)
else
Expand Down
8 changes: 6 additions & 2 deletions lua/which-key/win.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ M.__index = M

---@class wk.Win.opts
local override = {
relative = "editor",
style = "minimal",
focusable = false,
noautocmd = true,
Expand All @@ -29,7 +28,12 @@ local override = {
}

---@type wk.Win.opts
local defaults = { col = 0, row = math.huge, zindex = 1000 }
local defaults = {
relative = "editor",
col = 0,
row = math.huge,
zindex = 1000
}

---@param opts? wk.Win.opts
function M.defaults(opts)
Expand Down
Loading