neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit d6bd9c77335e6a0b936e5b15f1b1df7e8af7cafd
parent 91c192922da0240be5a8eb4045dae6cd968957e9
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun, 20 Nov 2022 21:38:29 +0800

test: add a test for #18222

Diffstat:
Mtest/functional/autocmd/winscrolled_spec.lua | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/test/functional/autocmd/winscrolled_spec.lua b/test/functional/autocmd/winscrolled_spec.lua @@ -130,4 +130,33 @@ describe('WinScrolled', function() feed('<C-E>') assert_alive() end) + + it('is triggered by mouse scrolling in unfocused floating window #18222', function() + local screen = Screen.new(80, 24) + screen:attach() + local buf = meths.create_buf(true, true) + meths.buf_set_lines(buf, 0, -1, false, {'a', 'b', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'}) + local win = meths.open_win(buf, false, { + height = 5, + width = 10, + col = 0, + row = 1, + relative = 'editor', + style = 'minimal' + }) + exec([[ + let g:scrolled = 0 + autocmd WinScrolled * let g:scrolled += 1 + autocmd WinScrolled * let g:amatch = expand('<amatch>') + ]]) + eq(0, eval('g:scrolled')) + + meths.input_mouse('wheel', 'down', '', 0, 3, 3) + eq(1, eval('g:scrolled')) + eq(tostring(win.id), eval('g:amatch')) + + meths.input_mouse('wheel', 'down', '', 0, 3, 3) + eq(2, eval('g:scrolled')) + eq(tostring(win.id), eval('g:amatch')) + end) end)