aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2023-09-10 15:09:20 +0800
committerglepnir <glephunter@gmail.com>2023-09-15 19:18:01 +0800
commita916523574135549865d698732a6c9eaae7c7811 (patch)
tree50f3979a3a8d988b805f854769715bd01e4396f2 /test/functional/ui/float_spec.lua
parent82150ca51bf396e5795b49f6e1cb2faaaa07b28b (diff)
downloadrneovim-a916523574135549865d698732a6c9eaae7c7811.tar.gz
rneovim-a916523574135549865d698732a6c9eaae7c7811.tar.bz2
rneovim-a916523574135549865d698732a6c9eaae7c7811.zip
fix(ui): doesn't trigger au event when enter is false
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 6cdd6e51fa..0cf8a124ff 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -415,6 +415,46 @@ describe('float window', function()
eq(winids, eval('winids'))
end)
+ it("open does not trigger BufEnter #15300", function()
+ local res = exec_lua[[
+ local times = {}
+ local buf = vim.api.nvim_create_buf(fasle, true)
+ vim.api.nvim_create_autocmd('BufEnter', {
+ callback = function(opt)
+ if opt.buf == buf then
+ times[#times + 1] = 1
+ end
+ end
+ })
+ local win_id
+ local fconfig = {
+ relative = 'editor',
+ row = 10,
+ col = 10,
+ width = 10,
+ height = 10,
+ }
+ --enter is false doesn't trigger
+ win_id = vim.api.nvim_open_win(buf, false, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 0 and true or nil
+
+ --enter is true trigger
+ win_id = vim.api.nvim_open_win(buf, true, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 2 and true or nil
+
+ --enter is true and fconfig.noautocmd is true doesn't trigger
+ fconfig.noautocmd = true
+ win_id = vim.api.nvim_open_win(buf, true, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 2 and true or nil
+
+ return times
+ ]]
+ eq({true, 1, true}, res)
+ end)
+
it('no crash with bufpos and non-existent window', function()
command('new')
local closed_win = meths.get_current_win().id