From adcf2c7f2f495f5df148683764bf7cba6a70f34c Mon Sep 17 00:00:00 2001 From: Rocky Zhang Date: Tue, 18 Jul 2023 09:12:57 -0700 Subject: [PATCH] fix: missing bottom border Fixes: https://github.com/lewis6991/gitsigns.nvim/issues/841 --- lua/gitsigns/popup.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/gitsigns/popup.lua b/lua/gitsigns/popup.lua index b655819a..d9914341 100644 --- a/lua/gitsigns/popup.lua +++ b/lua/gitsigns/popup.lua @@ -23,8 +23,9 @@ end -- Expand height until all lines are visible to account for wrapped lines. --- @param winid integer --- @param nlines integer -local function expand_height(winid, nlines) +local function expand_height(winid, nlines, border) local newheight = 0 + local maxheight = vim.o.lines - vim.o.cmdheight - (border ~= '' and 2 or 0) for _ = 0, 50 do local winheight = api.nvim_win_get_height(winid) if newheight > winheight then @@ -39,6 +40,10 @@ local function expand_height(winid, nlines) break end newheight = winheight + nlines - wd + if newheight > maxheight then + api.nvim_win_set_height(winid, maxheight) + break + end api.nvim_win_set_height(winid, newheight) end end @@ -145,7 +150,7 @@ function M.create0(lines, opts, id) vim.w[winid].gitsigns_preview = id or true if not opts.height then - expand_height(winid, #lines) + expand_height(winid, #lines, opts.border) end if opts1.style == 'minimal' then