Skip to content

Commit

Permalink
fix(ui): take border into account for window position. Fixes #812
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 21, 2023
1 parent 5f316ce commit 451f217
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/lazy/view/float.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {})

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 451f217

Please sign in to comment.