From 972a7dc9dfe860649edaf89e08c514a98d3a2a09 Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 27 Apr 2023 14:43:13 +0200 Subject: [PATCH] fix: utilize bufhidden=wipe instead of forcibly deleting buffer (#238) This fixes issues with autocmds such as `WinLeave` not firing, presumable due to the fact that the floating window gets disposed of when its buffer is deleted. This breaks plugins such as [tint.nvim][tint.nvim] who rely on `WinLeave` to function properly. [tint.nvim]: https://github.com/levouh/tint.nvim/issues/38 --- lua/neotest/client/strategies/integrated/init.lua | 1 + lua/neotest/consumers/output.lua | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/neotest/client/strategies/integrated/init.lua b/lua/neotest/client/strategies/integrated/init.lua index 8434c7e5..f9de7e43 100644 --- a/lua/neotest/client/strategies/integrated/init.lua +++ b/lua/neotest/client/strategies/integrated/init.lua @@ -91,6 +91,7 @@ return function(spec) buffer = attach_buf, }) vim.api.nvim_buf_set_option(attach_buf, "filetype", "neotest-attach") + vim.api.nvim_buf_set_option(attach_buf, "bufhidden", "wipe") attach_win:jump_to() end, result = function() diff --git a/lua/neotest/consumers/output.lua b/lua/neotest/consumers/output.lua index 9f5237d1..456da0d3 100644 --- a/lua/neotest/consumers/output.lua +++ b/lua/neotest/consumers/output.lua @@ -51,7 +51,6 @@ local function open_output(result, opts) end local on_close = function() - pcall(vim.api.nvim_buf_delete, buf, { force = true }) pcall(vim.fn.chanclose, chan) win = nil end