From 451f217e9b2d71f08bdae0ce5ac7e8e8a6503f48 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 21 May 2023 20:51:41 +0200 Subject: [PATCH] fix(ui): take border into account for window position. Fixes #812 --- lua/lazy/view/float.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lazy/view/float.lua b/lua/lazy/view/float.lua index 974fb8e..a7054ae 100644 --- a/lua/lazy/view/float.lua +++ b/lua/lazy/view/float.lua @@ -35,7 +35,7 @@ function M:init(opts) self.opts = vim.tbl_deep_extend("force", { size = Config.options.ui.size, style = "minimal", - border = Config.options.ui.border, + border = Config.options.ui.border or "none", zindex = 50, }, opts or {}) @@ -66,6 +66,11 @@ function M:layout() self.win_opts.row = math.floor((vim.o.lines - self.win_opts.height) / 2) self.win_opts.col = math.floor((vim.o.columns - self.win_opts.width) / 2) + if self.opts.border ~= "none" then + self.win_opts.row = self.win_opts.row - 1 + self.win_opts.col = self.win_opts.col - 1 + end + if self.opts.margin then if self.opts.margin.top then self.win_opts.height = self.win_opts.height - self.opts.margin.top