aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2025-04-21 23:38:46 +0200
committerWilliam Boman <william@redwill.se>2025-04-21 23:39:00 +0200
commit0847c02962a1cdf12528cf306f74633288369160 (patch)
treed8546b79c168d063e1f6fd7a4c6ad1ae99c53e5d /lua
parentfeat(ui): display current version in header (diff)
downloadmason-0847c02962a1cdf12528cf306f74633288369160.tar
mason-0847c02962a1cdf12528cf306f74633288369160.tar.gz
mason-0847c02962a1cdf12528cf306f74633288369160.tar.bz2
mason-0847c02962a1cdf12528cf306f74633288369160.tar.lz
mason-0847c02962a1cdf12528cf306f74633288369160.tar.xz
mason-0847c02962a1cdf12528cf306f74633288369160.tar.zst
mason-0847c02962a1cdf12528cf306f74633288369160.zip
feat(ui): support 'winborder'
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/ui/display.lua3
-rw-r--r--lua/mason/settings.lua3
-rw-r--r--lua/mason/ui/instance.lua12
3 files changed, 15 insertions, 3 deletions
diff --git a/lua/mason-core/ui/display.lua b/lua/mason-core/ui/display.lua
index a9e63910..72583a70 100644
--- a/lua/mason-core/ui/display.lua
+++ b/lua/mason-core/ui/display.lua
@@ -185,7 +185,7 @@ 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
+ if opts.border ~= "none" and opts.border ~= "" then
row = math.max(row - 1, 0)
col = math.max(col - 1, 0)
end
@@ -216,6 +216,7 @@ local function create_backdrop_window_opts()
col = 0,
style = "minimal",
focusable = false,
+ border = "none",
zindex = 44,
}
end
diff --git a/lua/mason/settings.lua b/lua/mason/settings.lua
index 895dfd0c..ebff1e0b 100644
--- a/lua/mason/settings.lua
+++ b/lua/mason/settings.lua
@@ -75,7 +75,8 @@ local DEFAULT_SETTINGS = {
---@since 1.0.0
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
- border = "none",
+ -- Defaults to `:h 'winborder'` if nil.
+ border = nil,
---@since 1.11.0
-- The backdrop opacity. 0 is fully opaque, 100 is fully transparent.
diff --git a/lua/mason/ui/instance.lua b/lua/mason/ui/instance.lua
index f5bf6f04..a49c585b 100644
--- a/lua/mason/ui/instance.lua
+++ b/lua/mason/ui/instance.lua
@@ -735,9 +735,19 @@ else
end)
end
+local border = settings.current.ui.border
+
+if border == nil then
+ if vim.fn.has "nvim-0.11" == 1 then
+ border = vim.o.winborder
+ else
+ border = "none"
+ end
+end
+
window.init {
effects = effects,
- border = settings.current.ui.border,
+ border = border,
winhighlight = {
"NormalFloat:MasonNormal",
},