From 9fc798754f212ea6e6871b8670eac504b9a3f4fe Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 11 Aug 2023 16:23:39 +0200 Subject: [PATCH] Ensure buffer is focused before resizing it. --- lua/neogit/lib/popup/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/neogit/lib/popup/init.lua b/lua/neogit/lib/popup/init.lua index 92781e1fc..9cc7fcf71 100644 --- a/lua/neogit/lib/popup/init.lua +++ b/lua/neogit/lib/popup/init.lua @@ -566,7 +566,7 @@ function M:show() filetype = "NeogitPopup", kind = config.values.popup.kind, mappings = mappings, - after = function() + after = function(buf, _) vim.cmd([[setlocal nocursorline]]) if self.state.env.highlight then @@ -585,7 +585,9 @@ function M:show() if config.values.popup.kind == "split" or config.values.popup.kind == "split_above" then vim.schedule(function() - vim.cmd.resize(vim.fn.line("$") + 2) + if buf:is_focused() then + vim.cmd.resize(vim.fn.line("$") + 1) + end end) end end,