aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/mason-core/ui/display.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/lua/mason-core/ui/display.lua b/lua/mason-core/ui/display.lua
index c4aebd95..3b616085 100644
--- a/lua/mason-core/ui/display.lua
+++ b/lua/mason-core/ui/display.lua
@@ -170,13 +170,10 @@ M._render_node = render_node
---@alias WindowOpts { effects?: table<string, fun()>, winhighlight?: string[], border?: string|table }
----@param size integer | float
+---@param size number
---@param viewport integer
local function calc_size(size, viewport)
- if size <= 1 then
- return math.ceil(size * viewport)
- end
- return math.min(size, viewport)
+ return size > 1 and math.min(size, viewport) or math.floor(size * viewport)
end
---@param opts WindowOpts
@@ -188,6 +185,11 @@ local function create_popup_window_opts(opts, sizes_only)
local width = calc_size(settings.current.ui.width, columns)
local row = math.floor((lines - height) / 2)
local col = math.floor((columns - width) / 2)
+ if opts.border ~= "none" then
+ row = math.max(row - 1, 0)
+ col = math.max(col - 1, 0)
+ end
+
local popup_layout = {
height = height,
width = width,