summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2022-04-21 22:52:11 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-21 22:52:11 +0100
commit66e13aedc7986c83644d537a8fdd3cb006507678 (patch)
tree4b7287de82d99492d9c089da74c0729ed3d15773 /src/testdir/test_autocmd.vim
parent7851c69a120ea6ce8c122dd7198adbe5aec83ea5 (diff)
patch 8.2.4803: WinScrolled not always triggered when scrolling with mousev8.2.4803
Problem: WinScrolled not always triggered when scrolling with the mouse. Solution: Add calls to may_trigger_winscrolled(). (closes #10246)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index c4ba10fcb5..466b6ec2e4 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -364,6 +364,37 @@ func Test_WinScrolled()
call delete('Xtest_winscrolled')
endfunc
+func Test_WinScrolled_mouse()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set nowrap scrolloff=0
+ set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard=
+ call setline(1, ['foo']->repeat(32))
+ split
+ let g:scrolled = 0
+ au WinScrolled * let g:scrolled += 1
+ END
+ call writefile(lines, 'Xtest_winscrolled_mouse')
+ let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10})
+
+ " With the upper split focused, send a scroll-down event to the unfocused one.
+ call test_setmouse(7, 1)
+ call term_sendkeys(buf, "\<ScrollWheelDown>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":echo g:scrolled\<CR>")
+ call WaitForAssert({-> assert_match('^1', term_getline(buf, 10))}, 1000)
+
+ " Again, but this time while we're in insert mode.
+ call term_sendkeys(buf, "i\<ScrollWheelDown>\<Esc>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":echo g:scrolled\<CR>")
+ call WaitForAssert({-> assert_match('^2', term_getline(buf, 10))}, 1000)
+
+ call StopVimInTerminal(buf)
+ call delete('Xtest_winscrolled_mouse')
+endfunc
+
func Test_WinScrolled_close_curwin()
CheckRunVimInTerminal
@@ -1572,7 +1603,7 @@ func Test_QuitPre()
" Close the other window, <afile> should be correct.
exe win_id2win(winid) . 'q'
call assert_equal('Xfoo', g:afile)
-
+
unlet g:afile
bwipe Xfoo
bwipe Xbar