diff options
| author | Pedro Gabriel de Morais Ribeiro <52004811+pedrog14@users.noreply.github.com> | 2025-02-15 14:34:17 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-15 18:34:17 +0100 |
| commit | f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e (patch) | |
| tree | e53a7150dcdc55f52f9c7fc71fca4aa62299a58f | |
| parent | fix: replace deprecated calls to vim.validate (#1876) (diff) | |
| download | mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar.gz mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar.bz2 mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar.lz mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar.xz mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.tar.zst mason-f9f3b464dda319288b8ce592e53f0d9cf9ca8b4e.zip | |
fix(ui): reposition window if border is different than "none" (#1859)
Co-authored-by: William Boman <william@redwill.se>
| -rw-r--r-- | lua/mason-core/ui/display.lua | 12 |
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, |
